<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE BangPatterns, CPP, ScopedTypeVariables #-}</span><span>
</span><span id="line-2"></span><span class="hs-pragma">{-# LANGUAGE ConstraintKinds #-}</span><span>
</span><span id="line-3"></span><span>
</span><span id="line-4"></span><span class="hs-pragma">{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}</span><span>
</span><span id="line-5"></span><span>
</span><span id="line-6"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-7"></span><span class="hs-comment">--</span><span>
</span><span id="line-8"></span><span class="hs-comment">-- The register allocator</span><span>
</span><span id="line-9"></span><span class="hs-comment">--</span><span>
</span><span id="line-10"></span><span class="hs-comment">-- (c) The University of Glasgow 2004</span><span>
</span><span id="line-11"></span><span class="hs-comment">--</span><span>
</span><span id="line-12"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-13"></span><span>
</span><span id="line-14"></span><span class="hs-comment">{-
The algorithm is roughly:

  1) Compute strongly connected components of the basic block list.

  2) Compute liveness (mapping from pseudo register to
     point(s) of death?).

  3) Walk instructions in each basic block.  We keep track of
        (a) Free real registers (a bitmap?)
        (b) Current assignment of temporaries to machine registers and/or
            spill slots (call this the &quot;assignment&quot;).
        (c) Partial mapping from basic block ids to a virt-to-loc mapping.
            When we first encounter a branch to a basic block,
            we fill in its entry in this table with the current mapping.

     For each instruction:
        (a) For each temporary *read* by the instruction:
            If the temporary does not have a real register allocation:
                - Allocate a real register from the free list.  If
                  the list is empty:
                  - Find a temporary to spill.  Pick one that is
                    not used in this instruction (ToDo: not
                    used for a while...)
                  - generate a spill instruction
                - If the temporary was previously spilled,
                  generate an instruction to read the temp from its spill loc.
            (optimisation: if we can see that a real register is going to
            be used soon, then don't use it for allocation).

        (b) For each real register clobbered by this instruction:
            If a temporary resides in it,
                If the temporary is live after this instruction,
                    Move the temporary to another (non-clobbered &amp; free) reg,
                    or spill it to memory.  Mark the temporary as residing
                    in both memory and a register if it was spilled (it might
                    need to be read by this instruction).

            (ToDo: this is wrong for jump instructions?)

            We do this after step (a), because if we start with
               movq v1, %rsi
            which is an instruction that clobbers %rsi, if v1 currently resides
            in %rsi we want to get
               movq %rsi, %freereg
               movq %rsi, %rsi     -- will disappear
            instead of
               movq %rsi, %freereg
               movq %freereg, %rsi

        (c) Update the current assignment

        (d) If the instruction is a branch:
              if the destination block already has a register assignment,
                Generate a new block with fixup code and redirect the
                jump to the new block.
              else,
                Update the block id-&gt;assignment mapping with the current
                assignment.

        (e) Delete all register assignments for temps which are read
            (only) and die here.  Update the free register list.

        (f) Mark all registers clobbered by this instruction as not free,
            and mark temporaries which have been spilled due to clobbering
            as in memory (step (a) marks then as in both mem &amp; reg).

        (g) For each temporary *written* by this instruction:
            Allocate a real register as for (b), spilling something
            else if necessary.
                - except when updating the assignment, drop any memory
                  locations that the temporary was previously in, since
                  they will be no longer valid after this instruction.

        (h) Delete all register assignments for temps which are
            written and die here (there should rarely be any).  Update
            the free register list.

        (i) Rewrite the instruction with the new mapping.

        (j) For each spilled reg known to be now dead, re-add its stack slot
            to the free list.

-}</span><span>
</span><span id="line-98"></span><span>
</span><span id="line-99"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.CmmToAsm.Reg.Linear</span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-100"></span><span>        </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.html#regAlloc"><span class="hs-identifier">regAlloc</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-101"></span><span>        </span><span class="hs-keyword">module</span><span>  </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html"><span class="hs-identifier">GHC.CmmToAsm.Reg.Linear.Base</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-102"></span><span>        </span><span class="hs-keyword">module</span><span>  </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Stats.html"><span class="hs-identifier">GHC.CmmToAsm.Reg.Linear.Stats</span></a></span><span>
</span><span id="line-103"></span><span>  </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span class="hs-cpp">

#include &quot;HsVersions.h&quot;
</span><span>
</span><span id="line-107"></span><span>
</span><span id="line-108"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Prelude.html"><span class="hs-identifier">GHC.Prelude</span></a></span><span>
</span><span id="line-109"></span><span>
</span><span id="line-110"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.State.html"><span class="hs-identifier">GHC.CmmToAsm.Reg.Linear.State</span></a></span><span>
</span><span id="line-111"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html"><span class="hs-identifier">GHC.CmmToAsm.Reg.Linear.Base</span></a></span><span>
</span><span id="line-112"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.StackMap.html"><span class="hs-identifier">GHC.CmmToAsm.Reg.Linear.StackMap</span></a></span><span>
</span><span id="line-113"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.FreeRegs.html"><span class="hs-identifier">GHC.CmmToAsm.Reg.Linear.FreeRegs</span></a></span><span>
</span><span id="line-114"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Stats.html"><span class="hs-identifier">GHC.CmmToAsm.Reg.Linear.Stats</span></a></span><span>
</span><span id="line-115"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.JoinToTargets.html"><span class="hs-identifier">GHC.CmmToAsm.Reg.Linear.JoinToTargets</span></a></span><span>
</span><span id="line-116"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.PPC.html"><span class="hs-identifier">GHC.CmmToAsm.Reg.Linear.PPC</span></a></span><span>    </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">PPC</span></span><span>
</span><span id="line-117"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.SPARC.html"><span class="hs-identifier">GHC.CmmToAsm.Reg.Linear.SPARC</span></a></span><span>  </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">SPARC</span></span><span>
</span><span id="line-118"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.X86.html"><span class="hs-identifier">GHC.CmmToAsm.Reg.Linear.X86</span></a></span><span>    </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">X86</span></span><span>
</span><span id="line-119"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.X86_64.html"><span class="hs-identifier">GHC.CmmToAsm.Reg.Linear.X86_64</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">X86_64</span></span><span>
</span><span id="line-120"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Target.html"><span class="hs-identifier">GHC.CmmToAsm.Reg.Target</span></a></span><span>
</span><span id="line-121"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html"><span class="hs-identifier">GHC.CmmToAsm.Reg.Liveness</span></a></span><span>
</span><span id="line-122"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Utils.html"><span class="hs-identifier">GHC.CmmToAsm.Reg.Utils</span></a></span><span>
</span><span id="line-123"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Instr.html"><span class="hs-identifier">GHC.CmmToAsm.Instr</span></a></span><span>
</span><span id="line-124"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Config.html"><span class="hs-identifier">GHC.CmmToAsm.Config</span></a></span><span>
</span><span id="line-125"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html"><span class="hs-identifier">GHC.Platform.Reg</span></a></span><span>
</span><span id="line-126"></span><span>
</span><span id="line-127"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Cmm.BlockId.html"><span class="hs-identifier">GHC.Cmm.BlockId</span></a></span><span>
</span><span id="line-128"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Cmm.Dataflow.Collections.html"><span class="hs-identifier">GHC.Cmm.Dataflow.Collections</span></a></span><span>
</span><span id="line-129"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Cmm.html"><span class="hs-identifier">GHC.Cmm</span></a></span><span> </span><span class="hs-keyword">hiding</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Cmm.Expr.html#RegSet"><span class="hs-identifier">RegSet</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-130"></span><span>
</span><span id="line-131"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Directed.html"><span class="hs-identifier">GHC.Data.Graph.Directed</span></a></span><span>
</span><span id="line-132"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Unique.html"><span class="hs-identifier">GHC.Types.Unique</span></a></span><span>
</span><span id="line-133"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Unique.Set.html"><span class="hs-identifier">GHC.Types.Unique.Set</span></a></span><span>
</span><span id="line-134"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Unique.FM.html"><span class="hs-identifier">GHC.Types.Unique.FM</span></a></span><span>
</span><span id="line-135"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Unique.Supply.html"><span class="hs-identifier">GHC.Types.Unique.Supply</span></a></span><span>
</span><span id="line-136"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html"><span class="hs-identifier">GHC.Utils.Outputable</span></a></span><span>
</span><span id="line-137"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../ghc-boot/src/GHC.Platform.html#"><span class="hs-identifier">GHC.Platform</span></a></span><span>
</span><span id="line-138"></span><span>
</span><span id="line-139"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Maybe.html#"><span class="hs-identifier">Data.Maybe</span></a></span><span>
</span><span id="line-140"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.List.html#"><span class="hs-identifier">Data.List</span></a></span><span>
</span><span id="line-141"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.html#"><span class="hs-identifier">Control.Monad</span></a></span><span>
</span><span id="line-142"></span><span>
</span><span id="line-143"></span><span class="hs-comment">-- -----------------------------------------------------------------------------</span><span>
</span><span id="line-144"></span><span class="hs-comment">-- Top level of the register allocator</span><span>
</span><span id="line-145"></span><span>
</span><span id="line-146"></span><span class="hs-comment">-- Allocate registers</span><span>
</span><span id="line-147"></span><span id="local-6989586621681032924"><span id="local-6989586621681032928"><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.html#regAlloc"><span class="hs-identifier hs-type">regAlloc</span></a></span><span>
</span><span id="line-148"></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032928"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Instr.html#Instruction"><span class="hs-identifier hs-type">Instruction</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032928"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-149"></span><span>        </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Config.html#NCGConfig"><span class="hs-identifier hs-type">NCGConfig</span></a></span><span>
</span><span id="line-150"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#LiveCmmDecl"><span class="hs-identifier hs-type">LiveCmmDecl</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032924"><span class="hs-identifier hs-type">statics</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032928"><span class="hs-identifier hs-type">instr</span></a></span><span>
</span><span id="line-151"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Unique.Supply.html#UniqSM"><span class="hs-identifier hs-type">UniqSM</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Instr.html#NatCmmDecl"><span class="hs-identifier hs-type">NatCmmDecl</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032924"><span class="hs-identifier hs-type">statics</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032928"><span class="hs-identifier hs-type">instr</span></a></span><span>
</span><span id="line-152"></span><span>                  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span>  </span><span class="hs-comment">-- number of extra stack slots required,</span><span>
</span><span id="line-153"></span><span>                               </span><span class="hs-comment">-- beyond maxSpillSlots</span><span>
</span><span id="line-154"></span><span>                  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#RegAllocStats"><span class="hs-identifier hs-type">RegAllocStats</span></a></span><span>
</span><span id="line-155"></span><span>                  </span><span class="hs-special">)</span></span></span><span>
</span><span id="line-156"></span><span>
</span><span id="line-157"></span><span id="regAlloc"><span class="annot"><span class="annottext">regAlloc :: forall instr statics.
(Outputable instr, Instruction instr) =&gt;
NCGConfig
-&gt; LiveCmmDecl statics instr
-&gt; UniqSM
     (NatCmmDecl statics instr, Maybe Int, Maybe RegAllocStats)
</span><a href="GHC.CmmToAsm.Reg.Linear.html#regAlloc"><span class="hs-identifier hs-var hs-var">regAlloc</span></a></span></span><span> </span><span class="annot"><span class="annottext">NCGConfig
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Cmm.html#CmmData"><span class="hs-identifier hs-type">CmmData</span></a></span><span> </span><span id="local-6989586621681032686"><span class="annot"><span class="annottext">Section
</span><a href="#local-6989586621681032686"><span class="hs-identifier hs-var">sec</span></a></span></span><span> </span><span id="local-6989586621681032685"><span class="annot"><span class="annottext">statics
</span><a href="#local-6989586621681032685"><span class="hs-identifier hs-var">d</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-158"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(GenCmmDecl statics (LabelMap RawCmmStatics) (ListGraph instr),
 Maybe Int, Maybe RegAllocStats)
-&gt; UniqSM
     (GenCmmDecl statics (LabelMap RawCmmStatics) (ListGraph instr),
      Maybe Int, Maybe RegAllocStats)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span>
</span><span id="line-159"></span><span>                </span><span class="hs-special">(</span><span> </span><span class="annot"><span class="annottext">Section
-&gt; statics
-&gt; GenCmmDecl statics (LabelMap RawCmmStatics) (ListGraph instr)
forall d h g. Section -&gt; d -&gt; GenCmmDecl d h g
</span><a href="GHC.Cmm.html#CmmData"><span class="hs-identifier hs-var">CmmData</span></a></span><span> </span><span class="annot"><span class="annottext">Section
</span><a href="#local-6989586621681032686"><span class="hs-identifier hs-var">sec</span></a></span><span> </span><span class="annot"><span class="annottext">statics
</span><a href="#local-6989586621681032685"><span class="hs-identifier hs-var">d</span></a></span><span>
</span><span id="line-160"></span><span>                </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Maybe Int
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-161"></span><span>                </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Maybe RegAllocStats
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-162"></span><span>
</span><span id="line-163"></span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.html#regAlloc"><span class="hs-identifier hs-var">regAlloc</span></a></span><span> </span><span class="annot"><span class="annottext">NCGConfig
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Cmm.html#CmmProc"><span class="hs-identifier hs-type">CmmProc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#LiveInfo"><span class="hs-identifier hs-type">LiveInfo</span></a></span><span> </span><span id="local-6989586621681032682"><span class="annot"><span class="annottext">LabelMap RawCmmStatics
</span><a href="#local-6989586621681032682"><span class="hs-identifier hs-var">info</span></a></span></span><span> </span><span class="annot"><span class="annottext">[BlockId]
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">BlockMap RegSet
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">BlockMap IntSet
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681032681"><span class="annot"><span class="annottext">CLabel
</span><a href="#local-6989586621681032681"><span class="hs-identifier hs-var">lbl</span></a></span></span><span> </span><span id="local-6989586621681032680"><span class="annot"><span class="annottext">[GlobalReg]
</span><a href="#local-6989586621681032680"><span class="hs-identifier hs-var">live</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-164"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(GenCmmDecl statics (LabelMap RawCmmStatics) (ListGraph instr),
 Maybe Int, Maybe RegAllocStats)
-&gt; UniqSM
     (GenCmmDecl statics (LabelMap RawCmmStatics) (ListGraph instr),
      Maybe Int, Maybe RegAllocStats)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><span class="annottext">LabelMap RawCmmStatics
-&gt; CLabel
-&gt; [GlobalReg]
-&gt; ListGraph instr
-&gt; GenCmmDecl statics (LabelMap RawCmmStatics) (ListGraph instr)
forall d h g. h -&gt; CLabel -&gt; [GlobalReg] -&gt; g -&gt; GenCmmDecl d h g
</span><a href="GHC.Cmm.html#CmmProc"><span class="hs-identifier hs-var">CmmProc</span></a></span><span> </span><span class="annot"><span class="annottext">LabelMap RawCmmStatics
</span><a href="#local-6989586621681032682"><span class="hs-identifier hs-var">info</span></a></span><span> </span><span class="annot"><span class="annottext">CLabel
</span><a href="#local-6989586621681032681"><span class="hs-identifier hs-var">lbl</span></a></span><span> </span><span class="annot"><span class="annottext">[GlobalReg]
</span><a href="#local-6989586621681032680"><span class="hs-identifier hs-var">live</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[GenBasicBlock instr] -&gt; ListGraph instr
forall i. [GenBasicBlock i] -&gt; ListGraph i
</span><a href="GHC.Cmm.html#ListGraph"><span class="hs-identifier hs-var">ListGraph</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-165"></span><span>                 </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Maybe Int
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-166"></span><span>                 </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Maybe RegAllocStats
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-167"></span><span>
</span><span id="line-168"></span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.html#regAlloc"><span class="hs-identifier hs-var">regAlloc</span></a></span><span> </span><span id="local-6989586621681032678"><span class="annot"><span class="annottext">NCGConfig
</span><a href="#local-6989586621681032678"><span class="hs-identifier hs-var">config</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Cmm.html#CmmProc"><span class="hs-identifier hs-type">CmmProc</span></a></span><span> </span><span id="local-6989586621681032677"><span class="annot"><span class="annottext">LiveInfo
</span><a href="#local-6989586621681032677"><span class="hs-identifier hs-var">static</span></a></span></span><span> </span><span id="local-6989586621681032676"><span class="annot"><span class="annottext">CLabel
</span><a href="#local-6989586621681032676"><span class="hs-identifier hs-var">lbl</span></a></span></span><span> </span><span id="local-6989586621681032675"><span class="annot"><span class="annottext">[GlobalReg]
</span><a href="#local-6989586621681032675"><span class="hs-identifier hs-var">live</span></a></span></span><span> </span><span id="local-6989586621681032674"><span class="annot"><span class="annottext">[SCC (LiveBasicBlock instr)]
</span><a href="#local-6989586621681032674"><span class="hs-identifier hs-var">sccs</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-169"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#LiveInfo"><span class="hs-identifier hs-type">LiveInfo</span></a></span><span> </span><span id="local-6989586621681032673"><span class="annot"><span class="annottext">LabelMap RawCmmStatics
</span><a href="#local-6989586621681032673"><span class="hs-identifier hs-var">info</span></a></span></span><span> </span><span id="local-6989586621681032672"><span class="annot"><span class="annottext">entry_ids :: [BlockId]
</span><a href="#local-6989586621681032672"><span class="hs-identifier hs-var">entry_ids</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span id="local-6989586621681032671"><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681032671"><span class="hs-identifier hs-var">first_id</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span class="annot"><span class="annottext">[BlockId]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681032670"><span class="annot"><span class="annottext">BlockMap RegSet
</span><a href="#local-6989586621681032670"><span class="hs-identifier hs-var">block_live</span></a></span></span><span> </span><span class="annot"><span class="annottext">BlockMap IntSet
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">LiveInfo
</span><a href="#local-6989586621681032677"><span class="hs-identifier hs-var">static</span></a></span><span>
</span><span id="line-170"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-171"></span><span>                </span><span class="hs-comment">-- do register allocation on each component.</span><span>
</span><span id="line-172"></span><span>                </span><span class="hs-special">(</span><span id="local-6989586621681032669"><span class="annot"><span class="annottext">[GenBasicBlock instr]
</span><a href="#local-6989586621681032669"><span class="hs-identifier hs-var">final_blocks</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681032668"><span class="annot"><span class="annottext">RegAllocStats
</span><a href="#local-6989586621681032668"><span class="hs-identifier hs-var">stats</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681032667"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681032667"><span class="hs-identifier hs-var">stack_use</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-173"></span><span>                        </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">NCGConfig
-&gt; [BlockId]
-&gt; BlockMap RegSet
-&gt; [SCC (LiveBasicBlock instr)]
-&gt; UniqSM ([GenBasicBlock instr], RegAllocStats, Int)
forall instr.
(Outputable instr, Instruction instr) =&gt;
NCGConfig
-&gt; [BlockId]
-&gt; BlockMap RegSet
-&gt; [SCC (LiveBasicBlock instr)]
-&gt; UniqSM ([NatBasicBlock instr], RegAllocStats, Int)
</span><a href="GHC.CmmToAsm.Reg.Linear.html#linearRegAlloc"><span class="hs-identifier hs-var">linearRegAlloc</span></a></span><span> </span><span class="annot"><span class="annottext">NCGConfig
</span><a href="#local-6989586621681032678"><span class="hs-identifier hs-var">config</span></a></span><span> </span><span class="annot"><span class="annottext">[BlockId]
</span><a href="#local-6989586621681032672"><span class="hs-identifier hs-var">entry_ids</span></a></span><span> </span><span class="annot"><span class="annottext">BlockMap RegSet
</span><a href="#local-6989586621681032670"><span class="hs-identifier hs-var">block_live</span></a></span><span> </span><span class="annot"><span class="annottext">[SCC (LiveBasicBlock instr)]
</span><a href="#local-6989586621681032674"><span class="hs-identifier hs-var">sccs</span></a></span><span>
</span><span id="line-174"></span><span>
</span><span id="line-175"></span><span>                </span><span class="hs-comment">-- make sure the block that was first in the input list</span><span>
</span><span id="line-176"></span><span>                </span><span class="hs-comment">--      stays at the front of the output</span><span>
</span><span id="line-177"></span><span>                </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span id="local-6989586621681032663"><span class="annot"><span class="annottext">GenBasicBlock instr
</span><a href="#local-6989586621681032663"><span class="hs-identifier hs-var">first'</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span class="annot"><span class="annottext">[GenBasicBlock instr]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span id="local-6989586621681032662"><span class="annot"><span class="annottext">[GenBasicBlock instr]
</span><a href="#local-6989586621681032662"><span class="hs-identifier hs-var">rest'</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-178"></span><span>                                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(GenBasicBlock instr -&gt; Bool)
-&gt; [GenBasicBlock instr]
-&gt; ([GenBasicBlock instr], [GenBasicBlock instr])
forall a. (a -&gt; Bool) -&gt; [a] -&gt; ([a], [a])
</span><a href="../../base/src/Data.OldList.html#partition"><span class="hs-identifier hs-var">partition</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><span class="annottext">BlockId -&gt; BlockId -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681032671"><span class="hs-identifier hs-var">first_id</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(BlockId -&gt; Bool)
-&gt; (GenBasicBlock instr -&gt; BlockId) -&gt; GenBasicBlock instr -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">GenBasicBlock instr -&gt; BlockId
forall i. GenBasicBlock i -&gt; BlockId
</span><a href="GHC.Cmm.html#blockId"><span class="hs-identifier hs-var">blockId</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[GenBasicBlock instr]
</span><a href="#local-6989586621681032669"><span class="hs-identifier hs-var">final_blocks</span></a></span><span>
</span><span id="line-179"></span><span>
</span><span id="line-180"></span><span>                </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681032658"><span class="annot"><span class="annottext">max_spill_slots :: Int
</span><a href="#local-6989586621681032658"><span class="hs-identifier hs-var hs-var">max_spill_slots</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">NCGConfig -&gt; Int
</span><a href="GHC.CmmToAsm.Reg.Linear.FreeRegs.html#maxSpillSlots"><span class="hs-identifier hs-var">maxSpillSlots</span></a></span><span> </span><span class="annot"><span class="annottext">NCGConfig
</span><a href="#local-6989586621681032678"><span class="hs-identifier hs-var">config</span></a></span><span>
</span><span id="line-181"></span><span>                    </span><span id="local-6989586621681032652"><span class="annot"><span class="annottext">extra_stack :: Maybe Int
</span><a href="#local-6989586621681032652"><span class="hs-identifier hs-var hs-var">extra_stack</span></a></span></span><span>
</span><span id="line-182"></span><span>                      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681032667"><span class="hs-identifier hs-var">stack_use</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&gt;</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681032658"><span class="hs-identifier hs-var">max_spill_slots</span></a></span><span>
</span><span id="line-183"></span><span>                      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Maybe Int
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681032667"><span class="hs-identifier hs-var">stack_use</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681032658"><span class="hs-identifier hs-var">max_spill_slots</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-184"></span><span>                      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-185"></span><span>                      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe Int
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-186"></span><span>
</span><span id="line-187"></span><span>                </span><span class="annot"><span class="annottext">(GenCmmDecl statics (LabelMap RawCmmStatics) (ListGraph instr),
 Maybe Int, Maybe RegAllocStats)
-&gt; UniqSM
     (GenCmmDecl statics (LabelMap RawCmmStatics) (ListGraph instr),
      Maybe Int, Maybe RegAllocStats)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span>  </span><span class="hs-special">(</span><span> </span><span class="annot"><span class="annottext">LabelMap RawCmmStatics
-&gt; CLabel
-&gt; [GlobalReg]
-&gt; ListGraph instr
-&gt; GenCmmDecl statics (LabelMap RawCmmStatics) (ListGraph instr)
forall d h g. h -&gt; CLabel -&gt; [GlobalReg] -&gt; g -&gt; GenCmmDecl d h g
</span><a href="GHC.Cmm.html#CmmProc"><span class="hs-identifier hs-var">CmmProc</span></a></span><span> </span><span class="annot"><span class="annottext">LabelMap RawCmmStatics
</span><a href="#local-6989586621681032673"><span class="hs-identifier hs-var">info</span></a></span><span> </span><span class="annot"><span class="annottext">CLabel
</span><a href="#local-6989586621681032676"><span class="hs-identifier hs-var">lbl</span></a></span><span> </span><span class="annot"><span class="annottext">[GlobalReg]
</span><a href="#local-6989586621681032675"><span class="hs-identifier hs-var">live</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[GenBasicBlock instr] -&gt; ListGraph instr
forall i. [GenBasicBlock i] -&gt; ListGraph i
</span><a href="GHC.Cmm.html#ListGraph"><span class="hs-identifier hs-var">ListGraph</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GenBasicBlock instr
</span><a href="#local-6989586621681032663"><span class="hs-identifier hs-var">first'</span></a></span><span> </span><span class="annot"><span class="annottext">GenBasicBlock instr
-&gt; [GenBasicBlock instr] -&gt; [GenBasicBlock instr]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[GenBasicBlock instr]
</span><a href="#local-6989586621681032662"><span class="hs-identifier hs-var">rest'</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-188"></span><span>                        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Maybe Int
</span><a href="#local-6989586621681032652"><span class="hs-identifier hs-var">extra_stack</span></a></span><span>
</span><span id="line-189"></span><span>                        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">RegAllocStats -&gt; Maybe RegAllocStats
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">RegAllocStats
</span><a href="#local-6989586621681032668"><span class="hs-identifier hs-var">stats</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-190"></span><span>
</span><span id="line-191"></span><span class="hs-comment">-- bogus. to make non-exhaustive match warning go away.</span><span>
</span><span id="line-192"></span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.html#regAlloc"><span class="hs-identifier hs-var">regAlloc</span></a></span><span> </span><span class="annot"><span class="annottext">NCGConfig
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Cmm.html#CmmProc"><span class="hs-identifier hs-type">CmmProc</span></a></span><span> </span><span class="annot"><span class="annottext">LiveInfo
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">CLabel
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">[GlobalReg]
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">[SCC (LiveBasicBlock instr)]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>
</span><span id="line-193"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
-&gt; UniqSM
     (GenCmmDecl statics (LabelMap RawCmmStatics) (ListGraph instr),
      Maybe Int, Maybe RegAllocStats)
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;RegAllocLinear.regAlloc: no match&quot;</span></span><span>
</span><span id="line-194"></span><span>
</span><span id="line-195"></span><span>
</span><span id="line-196"></span><span class="hs-comment">-- -----------------------------------------------------------------------------</span><span>
</span><span id="line-197"></span><span class="hs-comment">-- Linear sweep to allocate registers</span><span>
</span><span id="line-198"></span><span>
</span><span id="line-199"></span><span>
</span><span id="line-200"></span><span class="hs-comment">-- | Do register allocation on some basic blocks.</span><span>
</span><span id="line-201"></span><span class="hs-comment">--   But be careful to allocate a block in an SCC only if it has</span><span>
</span><span id="line-202"></span><span class="hs-comment">--   an entry in the block map or it is the first block.</span><span>
</span><span id="line-203"></span><span class="hs-comment">--</span><span>
</span><span id="line-204"></span><span id="local-6989586621681032895"><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.html#linearRegAlloc"><span class="hs-identifier hs-type">linearRegAlloc</span></a></span><span>
</span><span id="line-205"></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032895"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Instr.html#Instruction"><span class="hs-identifier hs-type">Instruction</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032895"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-206"></span><span>        </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Config.html#NCGConfig"><span class="hs-identifier hs-type">NCGConfig</span></a></span><span>
</span><span id="line-207"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Cmm.BlockId.html#BlockId"><span class="hs-identifier hs-type">BlockId</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-comment">-- ^ entry points</span><span>
</span><span id="line-208"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#BlockMap"><span class="hs-identifier hs-type">BlockMap</span></a></span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#RegSet"><span class="hs-identifier hs-type">RegSet</span></a></span><span>
</span><span id="line-209"></span><span>              </span><span class="hs-comment">-- ^ live regs on entry to each basic block</span><span>
</span><span id="line-210"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../containers/src/Data.Graph.html#SCC"><span class="hs-identifier hs-type">SCC</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#LiveBasicBlock"><span class="hs-identifier hs-type">LiveBasicBlock</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032895"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-211"></span><span>              </span><span class="hs-comment">-- ^ instructions annotated with &quot;deaths&quot;</span><span>
</span><span id="line-212"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Unique.Supply.html#UniqSM"><span class="hs-identifier hs-type">UniqSM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="GHC.CmmToAsm.Instr.html#NatBasicBlock"><span class="hs-identifier hs-type">NatBasicBlock</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032895"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#RegAllocStats"><span class="hs-identifier hs-type">RegAllocStats</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span class="hs-special">)</span></span><span>
</span><span id="line-213"></span><span>
</span><span id="line-214"></span><span id="linearRegAlloc"><span class="annot"><span class="annottext">linearRegAlloc :: forall instr.
(Outputable instr, Instruction instr) =&gt;
NCGConfig
-&gt; [BlockId]
-&gt; BlockMap RegSet
-&gt; [SCC (LiveBasicBlock instr)]
-&gt; UniqSM ([NatBasicBlock instr], RegAllocStats, Int)
</span><a href="GHC.CmmToAsm.Reg.Linear.html#linearRegAlloc"><span class="hs-identifier hs-var hs-var">linearRegAlloc</span></a></span></span><span> </span><span id="local-6989586621681032624"><span class="annot"><span class="annottext">NCGConfig
</span><a href="#local-6989586621681032624"><span class="hs-identifier hs-var">config</span></a></span></span><span> </span><span id="local-6989586621681032623"><span class="annot"><span class="annottext">[BlockId]
</span><a href="#local-6989586621681032623"><span class="hs-identifier hs-var">entry_ids</span></a></span></span><span> </span><span id="local-6989586621681032622"><span class="annot"><span class="annottext">BlockMap RegSet
</span><a href="#local-6989586621681032622"><span class="hs-identifier hs-var">block_live</span></a></span></span><span> </span><span id="local-6989586621681032621"><span class="annot"><span class="annottext">[SCC (LiveBasicBlock instr)]
</span><a href="#local-6989586621681032621"><span class="hs-identifier hs-var">sccs</span></a></span></span><span>
</span><span id="line-215"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Platform -&gt; Arch
</span><a href="../../ghc-boot/src/GHC.Platform.html#platformArch"><span class="hs-identifier hs-var">platformArch</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681032619"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-216"></span><span>      </span><span class="annot"><span class="annottext">Arch
</span><a href="../../ghc-boot/src/GHC.Platform.html#ArchX86"><span class="hs-identifier hs-var">ArchX86</span></a></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">FreeRegs -&gt; UniqSM ([NatBasicBlock instr], RegAllocStats, Int)
forall {freeRegs}.
(FR freeRegs, Outputable freeRegs) =&gt;
freeRegs -&gt; UniqSM ([NatBasicBlock instr], RegAllocStats, Int)
</span><a href="#local-6989586621681032617"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">(FreeRegs -&gt; UniqSM ([NatBasicBlock instr], RegAllocStats, Int))
-&gt; FreeRegs -&gt; UniqSM ([NatBasicBlock instr], RegAllocStats, Int)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform -&gt; FreeRegs
forall freeRegs. FR freeRegs =&gt; Platform -&gt; freeRegs
</span><a href="GHC.CmmToAsm.Reg.Linear.FreeRegs.html#frInitFreeRegs"><span class="hs-identifier hs-var">frInitFreeRegs</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681032619"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.X86.html#FreeRegs"><span class="hs-identifier hs-type">X86.FreeRegs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-217"></span><span>      </span><span class="annot"><span class="annottext">Arch
</span><a href="../../ghc-boot/src/GHC.Platform.html#ArchX86_64"><span class="hs-identifier hs-var">ArchX86_64</span></a></span><span>     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">FreeRegs -&gt; UniqSM ([NatBasicBlock instr], RegAllocStats, Int)
forall {freeRegs}.
(FR freeRegs, Outputable freeRegs) =&gt;
freeRegs -&gt; UniqSM ([NatBasicBlock instr], RegAllocStats, Int)
</span><a href="#local-6989586621681032617"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">(FreeRegs -&gt; UniqSM ([NatBasicBlock instr], RegAllocStats, Int))
-&gt; FreeRegs -&gt; UniqSM ([NatBasicBlock instr], RegAllocStats, Int)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform -&gt; FreeRegs
forall freeRegs. FR freeRegs =&gt; Platform -&gt; freeRegs
</span><a href="GHC.CmmToAsm.Reg.Linear.FreeRegs.html#frInitFreeRegs"><span class="hs-identifier hs-var">frInitFreeRegs</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681032619"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.X86_64.html#FreeRegs"><span class="hs-identifier hs-type">X86_64.FreeRegs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-218"></span><span>      </span><span class="annot"><span class="annottext">Arch
</span><a href="../../ghc-boot/src/GHC.Platform.html#ArchS390X"><span class="hs-identifier hs-var">ArchS390X</span></a></span><span>      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; UniqSM ([NatBasicBlock instr], RegAllocStats, Int)
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;linearRegAlloc ArchS390X&quot;</span></span><span>
</span><span id="line-219"></span><span>      </span><span class="annot"><span class="annottext">Arch
</span><a href="../../ghc-boot/src/GHC.Platform.html#ArchSPARC"><span class="hs-identifier hs-var">ArchSPARC</span></a></span><span>      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">FreeRegs -&gt; UniqSM ([NatBasicBlock instr], RegAllocStats, Int)
forall {freeRegs}.
(FR freeRegs, Outputable freeRegs) =&gt;
freeRegs -&gt; UniqSM ([NatBasicBlock instr], RegAllocStats, Int)
</span><a href="#local-6989586621681032617"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">(FreeRegs -&gt; UniqSM ([NatBasicBlock instr], RegAllocStats, Int))
-&gt; FreeRegs -&gt; UniqSM ([NatBasicBlock instr], RegAllocStats, Int)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform -&gt; FreeRegs
forall freeRegs. FR freeRegs =&gt; Platform -&gt; freeRegs
</span><a href="GHC.CmmToAsm.Reg.Linear.FreeRegs.html#frInitFreeRegs"><span class="hs-identifier hs-var">frInitFreeRegs</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681032619"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.SPARC.html#FreeRegs"><span class="hs-identifier hs-type">SPARC.FreeRegs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-220"></span><span>      </span><span class="annot"><span class="annottext">Arch
</span><a href="../../ghc-boot/src/GHC.Platform.html#ArchSPARC64"><span class="hs-identifier hs-var">ArchSPARC64</span></a></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; UniqSM ([NatBasicBlock instr], RegAllocStats, Int)
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;linearRegAlloc ArchSPARC64&quot;</span></span><span>
</span><span id="line-221"></span><span>      </span><span class="annot"><span class="annottext">Arch
</span><a href="../../ghc-boot/src/GHC.Platform.html#ArchPPC"><span class="hs-identifier hs-var">ArchPPC</span></a></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">FreeRegs -&gt; UniqSM ([NatBasicBlock instr], RegAllocStats, Int)
forall {freeRegs}.
(FR freeRegs, Outputable freeRegs) =&gt;
freeRegs -&gt; UniqSM ([NatBasicBlock instr], RegAllocStats, Int)
</span><a href="#local-6989586621681032617"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">(FreeRegs -&gt; UniqSM ([NatBasicBlock instr], RegAllocStats, Int))
-&gt; FreeRegs -&gt; UniqSM ([NatBasicBlock instr], RegAllocStats, Int)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform -&gt; FreeRegs
forall freeRegs. FR freeRegs =&gt; Platform -&gt; freeRegs
</span><a href="GHC.CmmToAsm.Reg.Linear.FreeRegs.html#frInitFreeRegs"><span class="hs-identifier hs-var">frInitFreeRegs</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681032619"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.PPC.html#FreeRegs"><span class="hs-identifier hs-type">PPC.FreeRegs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-222"></span><span>      </span><span class="annot"><a href="../../ghc-boot/src/GHC.Platform.html#ArchARM"><span class="hs-identifier hs-type">ArchARM</span></a></span><span> </span><span class="annot"><span class="annottext">ArmISA
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">[ArmISAExt]
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">ArmABI
</span><span class="hs-identifier">_</span></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; UniqSM ([NatBasicBlock instr], RegAllocStats, Int)
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;linearRegAlloc ArchARM&quot;</span></span><span>
</span><span id="line-223"></span><span>      </span><span class="annot"><span class="annottext">Arch
</span><a href="../../ghc-boot/src/GHC.Platform.html#ArchAArch64"><span class="hs-identifier hs-var">ArchAArch64</span></a></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; UniqSM ([NatBasicBlock instr], RegAllocStats, Int)
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;linearRegAlloc ArchAArch64&quot;</span></span><span>
</span><span id="line-224"></span><span>      </span><span class="annot"><a href="../../ghc-boot/src/GHC.Platform.html#ArchPPC_64"><span class="hs-identifier hs-type">ArchPPC_64</span></a></span><span> </span><span class="annot"><span class="annottext">PPC_64ABI
</span><span class="hs-identifier">_</span></span><span>   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">FreeRegs -&gt; UniqSM ([NatBasicBlock instr], RegAllocStats, Int)
forall {freeRegs}.
(FR freeRegs, Outputable freeRegs) =&gt;
freeRegs -&gt; UniqSM ([NatBasicBlock instr], RegAllocStats, Int)
</span><a href="#local-6989586621681032617"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">(FreeRegs -&gt; UniqSM ([NatBasicBlock instr], RegAllocStats, Int))
-&gt; FreeRegs -&gt; UniqSM ([NatBasicBlock instr], RegAllocStats, Int)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform -&gt; FreeRegs
forall freeRegs. FR freeRegs =&gt; Platform -&gt; freeRegs
</span><a href="GHC.CmmToAsm.Reg.Linear.FreeRegs.html#frInitFreeRegs"><span class="hs-identifier hs-var">frInitFreeRegs</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681032619"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.PPC.html#FreeRegs"><span class="hs-identifier hs-type">PPC.FreeRegs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-225"></span><span>      </span><span class="annot"><span class="annottext">Arch
</span><a href="../../ghc-boot/src/GHC.Platform.html#ArchAlpha"><span class="hs-identifier hs-var">ArchAlpha</span></a></span><span>      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; UniqSM ([NatBasicBlock instr], RegAllocStats, Int)
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;linearRegAlloc ArchAlpha&quot;</span></span><span>
</span><span id="line-226"></span><span>      </span><span class="annot"><span class="annottext">Arch
</span><a href="../../ghc-boot/src/GHC.Platform.html#ArchMipseb"><span class="hs-identifier hs-var">ArchMipseb</span></a></span><span>     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; UniqSM ([NatBasicBlock instr], RegAllocStats, Int)
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;linearRegAlloc ArchMipseb&quot;</span></span><span>
</span><span id="line-227"></span><span>      </span><span class="annot"><span class="annottext">Arch
</span><a href="../../ghc-boot/src/GHC.Platform.html#ArchMipsel"><span class="hs-identifier hs-var">ArchMipsel</span></a></span><span>     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; UniqSM ([NatBasicBlock instr], RegAllocStats, Int)
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;linearRegAlloc ArchMipsel&quot;</span></span><span>
</span><span id="line-228"></span><span>      </span><span class="annot"><span class="annottext">Arch
</span><a href="../../ghc-boot/src/GHC.Platform.html#ArchJavaScript"><span class="hs-identifier hs-var">ArchJavaScript</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; UniqSM ([NatBasicBlock instr], RegAllocStats, Int)
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;linearRegAlloc ArchJavaScript&quot;</span></span><span>
</span><span id="line-229"></span><span>      </span><span class="annot"><span class="annottext">Arch
</span><a href="../../ghc-boot/src/GHC.Platform.html#ArchUnknown"><span class="hs-identifier hs-var">ArchUnknown</span></a></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; UniqSM ([NatBasicBlock instr], RegAllocStats, Int)
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;linearRegAlloc ArchUnknown&quot;</span></span><span>
</span><span id="line-230"></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-231"></span><span>  </span><span id="local-6989586621681032617"><span class="annot"><span class="annottext">go :: freeRegs -&gt; UniqSM ([NatBasicBlock instr], RegAllocStats, Int)
</span><a href="#local-6989586621681032617"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621681032595"><span class="annot"><span class="annottext">freeRegs
</span><a href="#local-6989586621681032595"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">NCGConfig
-&gt; freeRegs
-&gt; [BlockId]
-&gt; BlockMap RegSet
-&gt; [SCC (LiveBasicBlock instr)]
-&gt; UniqSM ([NatBasicBlock instr], RegAllocStats, Int)
forall freeRegs instr.
OutputableRegConstraint freeRegs instr =&gt;
NCGConfig
-&gt; freeRegs
-&gt; [BlockId]
-&gt; BlockMap RegSet
-&gt; [SCC (LiveBasicBlock instr)]
-&gt; UniqSM ([NatBasicBlock instr], RegAllocStats, Int)
</span><a href="GHC.CmmToAsm.Reg.Linear.html#linearRegAlloc%27"><span class="hs-identifier hs-var">linearRegAlloc'</span></a></span><span> </span><span class="annot"><span class="annottext">NCGConfig
</span><a href="#local-6989586621681032624"><span class="hs-identifier hs-var">config</span></a></span><span> </span><span class="annot"><span class="annottext">freeRegs
</span><a href="#local-6989586621681032595"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">[BlockId]
</span><a href="#local-6989586621681032623"><span class="hs-identifier hs-var">entry_ids</span></a></span><span> </span><span class="annot"><span class="annottext">BlockMap RegSet
</span><a href="#local-6989586621681032622"><span class="hs-identifier hs-var">block_live</span></a></span><span> </span><span class="annot"><span class="annottext">[SCC (LiveBasicBlock instr)]
</span><a href="#local-6989586621681032621"><span class="hs-identifier hs-var">sccs</span></a></span><span>
</span><span id="line-232"></span><span>  </span><span id="local-6989586621681032619"><span class="annot"><span class="annottext">platform :: Platform
</span><a href="#local-6989586621681032619"><span class="hs-identifier hs-var hs-var">platform</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">NCGConfig -&gt; Platform
</span><a href="GHC.CmmToAsm.Config.html#ncgPlatform"><span class="hs-identifier hs-var hs-var">ncgPlatform</span></a></span><span> </span><span class="annot"><span class="annottext">NCGConfig
</span><a href="#local-6989586621681032624"><span class="hs-identifier hs-var">config</span></a></span><span>
</span><span id="line-233"></span><span>
</span><span id="line-234"></span><span class="hs-comment">-- | Constraints on the instruction instances used by the</span><span>
</span><span id="line-235"></span><span class="hs-comment">-- linear allocator.</span><span>
</span><span id="line-236"></span><span class="hs-keyword">type</span><span> </span><span id="OutputableRegConstraint"><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.html#OutputableRegConstraint"><span class="hs-identifier hs-var">OutputableRegConstraint</span></a></span></span><span> </span><span id="local-6989586621681032592"><span class="annot"><a href="#local-6989586621681032592"><span class="hs-identifier hs-type">freeRegs</span></a></span></span><span> </span><span id="local-6989586621681032591"><span class="annot"><a href="#local-6989586621681032591"><span class="hs-identifier hs-type">instr</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-237"></span><span>        </span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.FreeRegs.html#FR"><span class="hs-identifier hs-type">FR</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032592"><span class="hs-identifier hs-type">freeRegs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032592"><span class="hs-identifier hs-type">freeRegs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032591"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Instr.html#Instruction"><span class="hs-identifier hs-type">Instruction</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032591"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-238"></span><span>
</span><span id="line-239"></span><span id="local-6989586621681032865"><span id="local-6989586621681032866"><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.html#linearRegAlloc%27"><span class="hs-identifier hs-type">linearRegAlloc'</span></a></span><span>
</span><span id="line-240"></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.html#OutputableRegConstraint"><span class="hs-identifier hs-type">OutputableRegConstraint</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032866"><span class="hs-identifier hs-type">freeRegs</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032865"><span class="hs-identifier hs-type">instr</span></a></span><span>
</span><span id="line-241"></span><span>        </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Config.html#NCGConfig"><span class="hs-identifier hs-type">NCGConfig</span></a></span><span>
</span><span id="line-242"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621681032866"><span class="hs-identifier hs-type">freeRegs</span></a></span><span>
</span><span id="line-243"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Cmm.BlockId.html#BlockId"><span class="hs-identifier hs-type">BlockId</span></a></span><span class="hs-special">]</span><span>                    </span><span class="hs-comment">-- ^ entry points</span><span>
</span><span id="line-244"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#BlockMap"><span class="hs-identifier hs-type">BlockMap</span></a></span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#RegSet"><span class="hs-identifier hs-type">RegSet</span></a></span><span>              </span><span class="hs-comment">-- ^ live regs on entry to each basic block</span><span>
</span><span id="line-245"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../containers/src/Data.Graph.html#SCC"><span class="hs-identifier hs-type">SCC</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#LiveBasicBlock"><span class="hs-identifier hs-type">LiveBasicBlock</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032865"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-comment">-- ^ instructions annotated with &quot;deaths&quot;</span><span>
</span><span id="line-246"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Unique.Supply.html#UniqSM"><span class="hs-identifier hs-type">UniqSM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="GHC.CmmToAsm.Instr.html#NatBasicBlock"><span class="hs-identifier hs-type">NatBasicBlock</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032865"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#RegAllocStats"><span class="hs-identifier hs-type">RegAllocStats</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span class="hs-special">)</span></span></span><span>
</span><span id="line-247"></span><span>
</span><span id="line-248"></span><span id="linearRegAlloc%27"><span class="annot"><span class="annottext">linearRegAlloc' :: forall freeRegs instr.
OutputableRegConstraint freeRegs instr =&gt;
NCGConfig
-&gt; freeRegs
-&gt; [BlockId]
-&gt; BlockMap RegSet
-&gt; [SCC (LiveBasicBlock instr)]
-&gt; UniqSM ([NatBasicBlock instr], RegAllocStats, Int)
</span><a href="GHC.CmmToAsm.Reg.Linear.html#linearRegAlloc%27"><span class="hs-identifier hs-var hs-var">linearRegAlloc'</span></a></span></span><span> </span><span id="local-6989586621681032577"><span class="annot"><span class="annottext">NCGConfig
</span><a href="#local-6989586621681032577"><span class="hs-identifier hs-var">config</span></a></span></span><span> </span><span id="local-6989586621681032576"><span class="annot"><span class="annottext">freeRegs
</span><a href="#local-6989586621681032576"><span class="hs-identifier hs-var">initFreeRegs</span></a></span></span><span> </span><span id="local-6989586621681032575"><span class="annot"><span class="annottext">[BlockId]
</span><a href="#local-6989586621681032575"><span class="hs-identifier hs-var">entry_ids</span></a></span></span><span> </span><span id="local-6989586621681032574"><span class="annot"><span class="annottext">BlockMap RegSet
</span><a href="#local-6989586621681032574"><span class="hs-identifier hs-var">block_live</span></a></span></span><span> </span><span id="local-6989586621681032573"><span class="annot"><span class="annottext">[SCC (LiveBasicBlock instr)]
</span><a href="#local-6989586621681032573"><span class="hs-identifier hs-var">sccs</span></a></span></span><span>
</span><span id="line-249"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>   </span><span id="local-6989586621681032572"><span class="annot"><span class="annottext">UniqSupply
</span><a href="#local-6989586621681032572"><span class="hs-identifier hs-var">us</span></a></span></span><span>      </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">UniqSM UniqSupply
forall (m :: * -&gt; *). MonadUnique m =&gt; m UniqSupply
</span><a href="GHC.Types.Unique.Supply.html#getUniqueSupplyM"><span class="hs-identifier hs-var">getUniqueSupplyM</span></a></span><span>
</span><span id="line-250"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span class="hs-glyph">!</span><span class="hs-special">(</span><span class="annot"><span class="annottext">BlockAssignment freeRegs
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621681032565"><span class="annot"><span class="annottext">StackMap
</span><a href="#local-6989586621681032565"><span class="hs-identifier hs-var">stack</span></a></span></span><span class="hs-special">,</span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621681032564"><span class="annot"><span class="annottext">RegAllocStats
</span><a href="#local-6989586621681032564"><span class="hs-identifier hs-var">stats</span></a></span></span><span class="hs-special">,</span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621681032563"><span class="annot"><span class="annottext">[NatBasicBlock instr]
</span><a href="#local-6989586621681032563"><span class="hs-identifier hs-var">blocks</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-251"></span><span>                </span><span class="annot"><span class="annottext">NCGConfig
-&gt; BlockAssignment freeRegs
-&gt; freeRegs
-&gt; RegMap Loc
-&gt; StackMap
-&gt; UniqSupply
-&gt; RegM freeRegs [NatBasicBlock instr]
-&gt; (BlockAssignment freeRegs, StackMap, RegAllocStats,
    [NatBasicBlock instr])
forall freeRegs a.
NCGConfig
-&gt; BlockAssignment freeRegs
-&gt; freeRegs
-&gt; RegMap Loc
-&gt; StackMap
-&gt; UniqSupply
-&gt; RegM freeRegs a
-&gt; (BlockAssignment freeRegs, StackMap, RegAllocStats, a)
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#runR"><span class="hs-identifier hs-var">runR</span></a></span><span> </span><span class="annot"><span class="annottext">NCGConfig
</span><a href="#local-6989586621681032577"><span class="hs-identifier hs-var">config</span></a></span><span> </span><span class="annot"><span class="annottext">BlockAssignment freeRegs
forall freeRegs. BlockAssignment freeRegs
</span><a href="GHC.CmmToAsm.Reg.Linear.Base.html#emptyBlockAssignment"><span class="hs-identifier hs-var">emptyBlockAssignment</span></a></span><span> </span><span class="annot"><span class="annottext">freeRegs
</span><a href="#local-6989586621681032576"><span class="hs-identifier hs-var">initFreeRegs</span></a></span><span> </span><span class="annot"><span class="annottext">RegMap Loc
forall a. RegMap a
</span><a href="GHC.CmmToAsm.Reg.Liveness.html#emptyRegMap"><span class="hs-identifier hs-var">emptyRegMap</span></a></span><span> </span><span class="annot"><span class="annottext">StackMap
</span><a href="GHC.CmmToAsm.Reg.Linear.StackMap.html#emptyStackMap"><span class="hs-identifier hs-var">emptyStackMap</span></a></span><span> </span><span class="annot"><span class="annottext">UniqSupply
</span><a href="#local-6989586621681032572"><span class="hs-identifier hs-var">us</span></a></span><span>
</span><span id="line-252"></span><span>                    </span><span class="annot"><span class="annottext">(RegM freeRegs [NatBasicBlock instr]
 -&gt; (BlockAssignment freeRegs, StackMap, RegAllocStats,
     [NatBasicBlock instr]))
-&gt; RegM freeRegs [NatBasicBlock instr]
-&gt; (BlockAssignment freeRegs, StackMap, RegAllocStats,
    [NatBasicBlock instr])
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[BlockId]
-&gt; BlockMap RegSet
-&gt; [NatBasicBlock instr]
-&gt; [SCC (LiveBasicBlock instr)]
-&gt; RegM freeRegs [NatBasicBlock instr]
forall freeRegs instr.
OutputableRegConstraint freeRegs instr =&gt;
[BlockId]
-&gt; BlockMap RegSet
-&gt; [NatBasicBlock instr]
-&gt; [SCC (LiveBasicBlock instr)]
-&gt; RegM freeRegs [NatBasicBlock instr]
</span><a href="GHC.CmmToAsm.Reg.Linear.html#linearRA_SCCs"><span class="hs-identifier hs-var">linearRA_SCCs</span></a></span><span> </span><span class="annot"><span class="annottext">[BlockId]
</span><a href="#local-6989586621681032575"><span class="hs-identifier hs-var">entry_ids</span></a></span><span> </span><span class="annot"><span class="annottext">BlockMap RegSet
</span><a href="#local-6989586621681032574"><span class="hs-identifier hs-var">block_live</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">[SCC (LiveBasicBlock instr)]
</span><a href="#local-6989586621681032573"><span class="hs-identifier hs-var">sccs</span></a></span><span>
</span><span id="line-253"></span><span>        </span><span class="annot"><span class="annottext">([NatBasicBlock instr], RegAllocStats, Int)
-&gt; UniqSM ([NatBasicBlock instr], RegAllocStats, Int)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span>  </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[NatBasicBlock instr]
</span><a href="#local-6989586621681032563"><span class="hs-identifier hs-var">blocks</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">RegAllocStats
</span><a href="#local-6989586621681032564"><span class="hs-identifier hs-var">stats</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">StackMap -&gt; Int
</span><a href="GHC.CmmToAsm.Reg.Linear.StackMap.html#getStackUse"><span class="hs-identifier hs-var">getStackUse</span></a></span><span> </span><span class="annot"><span class="annottext">StackMap
</span><a href="#local-6989586621681032565"><span class="hs-identifier hs-var">stack</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-254"></span><span>
</span><span id="line-255"></span><span>
</span><span id="line-256"></span><span id="local-6989586621681032845"><span id="local-6989586621681032846"><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.html#linearRA_SCCs"><span class="hs-identifier hs-type">linearRA_SCCs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.html#OutputableRegConstraint"><span class="hs-identifier hs-type">OutputableRegConstraint</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032846"><span class="hs-identifier hs-type">freeRegs</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032845"><span class="hs-identifier hs-type">instr</span></a></span><span>
</span><span id="line-257"></span><span>              </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Cmm.BlockId.html#BlockId"><span class="hs-identifier hs-type">BlockId</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-258"></span><span>              </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#BlockMap"><span class="hs-identifier hs-type">BlockMap</span></a></span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#RegSet"><span class="hs-identifier hs-type">RegSet</span></a></span><span>
</span><span id="line-259"></span><span>              </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.CmmToAsm.Instr.html#NatBasicBlock"><span class="hs-identifier hs-type">NatBasicBlock</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032845"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-260"></span><span>              </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../containers/src/Data.Graph.html#SCC"><span class="hs-identifier hs-type">SCC</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#LiveBasicBlock"><span class="hs-identifier hs-type">LiveBasicBlock</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032845"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-261"></span><span>              </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.State.html#RegM"><span class="hs-identifier hs-type">RegM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032846"><span class="hs-identifier hs-type">freeRegs</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.CmmToAsm.Instr.html#NatBasicBlock"><span class="hs-identifier hs-type">NatBasicBlock</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032845"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">]</span></span></span><span>
</span><span id="line-262"></span><span>
</span><span id="line-263"></span><span id="linearRA_SCCs"><span class="annot"><span class="annottext">linearRA_SCCs :: forall freeRegs instr.
OutputableRegConstraint freeRegs instr =&gt;
[BlockId]
-&gt; BlockMap RegSet
-&gt; [NatBasicBlock instr]
-&gt; [SCC (LiveBasicBlock instr)]
-&gt; RegM freeRegs [NatBasicBlock instr]
</span><a href="GHC.CmmToAsm.Reg.Linear.html#linearRA_SCCs"><span class="hs-identifier hs-var hs-var">linearRA_SCCs</span></a></span></span><span> </span><span class="annot"><span class="annottext">[BlockId]
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">BlockMap RegSet
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681032543"><span class="annot"><span class="annottext">[NatBasicBlock instr]
</span><a href="#local-6989586621681032543"><span class="hs-identifier hs-var">blocksAcc</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-264"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[NatBasicBlock instr] -&gt; RegM freeRegs [NatBasicBlock instr]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">([NatBasicBlock instr] -&gt; RegM freeRegs [NatBasicBlock instr])
-&gt; [NatBasicBlock instr] -&gt; RegM freeRegs [NatBasicBlock instr]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[NatBasicBlock instr] -&gt; [NatBasicBlock instr]
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="annot"><span class="annottext">[NatBasicBlock instr]
</span><a href="#local-6989586621681032543"><span class="hs-identifier hs-var">blocksAcc</span></a></span><span>
</span><span id="line-265"></span><span>
</span><span id="line-266"></span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.html#linearRA_SCCs"><span class="hs-identifier hs-var">linearRA_SCCs</span></a></span><span> </span><span id="local-6989586621681032541"><span class="annot"><span class="annottext">[BlockId]
</span><a href="#local-6989586621681032541"><span class="hs-identifier hs-var">entry_ids</span></a></span></span><span> </span><span id="local-6989586621681032540"><span class="annot"><span class="annottext">BlockMap RegSet
</span><a href="#local-6989586621681032540"><span class="hs-identifier hs-var">block_live</span></a></span></span><span> </span><span id="local-6989586621681032539"><span class="annot"><span class="annottext">[NatBasicBlock instr]
</span><a href="#local-6989586621681032539"><span class="hs-identifier hs-var">blocksAcc</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../containers/src/Data.Graph.html#AcyclicSCC"><span class="hs-identifier hs-type">AcyclicSCC</span></a></span><span> </span><span id="local-6989586621681032537"><span class="annot"><span class="annottext">LiveBasicBlock instr
</span><a href="#local-6989586621681032537"><span class="hs-identifier hs-var">block</span></a></span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621681032536"><span class="annot"><span class="annottext">[SCC (LiveBasicBlock instr)]
</span><a href="#local-6989586621681032536"><span class="hs-identifier hs-var">sccs</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-267"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>   </span><span id="local-6989586621681032535"><span class="annot"><span class="annottext">[NatBasicBlock instr]
</span><a href="#local-6989586621681032535"><span class="hs-identifier hs-var">blocks'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">BlockMap RegSet
-&gt; LiveBasicBlock instr -&gt; RegM freeRegs [NatBasicBlock instr]
forall freeRegs instr.
OutputableRegConstraint freeRegs instr =&gt;
BlockMap RegSet
-&gt; LiveBasicBlock instr -&gt; RegM freeRegs [NatBasicBlock instr]
</span><a href="GHC.CmmToAsm.Reg.Linear.html#processBlock"><span class="hs-identifier hs-var">processBlock</span></a></span><span> </span><span class="annot"><span class="annottext">BlockMap RegSet
</span><a href="#local-6989586621681032540"><span class="hs-identifier hs-var">block_live</span></a></span><span> </span><span class="annot"><span class="annottext">LiveBasicBlock instr
</span><a href="#local-6989586621681032537"><span class="hs-identifier hs-var">block</span></a></span><span>
</span><span id="line-268"></span><span>        </span><span class="annot"><span class="annottext">[BlockId]
-&gt; BlockMap RegSet
-&gt; [NatBasicBlock instr]
-&gt; [SCC (LiveBasicBlock instr)]
-&gt; RegM freeRegs [NatBasicBlock instr]
forall freeRegs instr.
OutputableRegConstraint freeRegs instr =&gt;
[BlockId]
-&gt; BlockMap RegSet
-&gt; [NatBasicBlock instr]
-&gt; [SCC (LiveBasicBlock instr)]
-&gt; RegM freeRegs [NatBasicBlock instr]
</span><a href="GHC.CmmToAsm.Reg.Linear.html#linearRA_SCCs"><span class="hs-identifier hs-var">linearRA_SCCs</span></a></span><span> </span><span class="annot"><span class="annottext">[BlockId]
</span><a href="#local-6989586621681032541"><span class="hs-identifier hs-var">entry_ids</span></a></span><span> </span><span class="annot"><span class="annottext">BlockMap RegSet
</span><a href="#local-6989586621681032540"><span class="hs-identifier hs-var">block_live</span></a></span><span>
</span><span id="line-269"></span><span>                </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><span class="annottext">[NatBasicBlock instr] -&gt; [NatBasicBlock instr]
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="annot"><span class="annottext">[NatBasicBlock instr]
</span><a href="#local-6989586621681032535"><span class="hs-identifier hs-var">blocks'</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[NatBasicBlock instr]
-&gt; [NatBasicBlock instr] -&gt; [NatBasicBlock instr]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[NatBasicBlock instr]
</span><a href="#local-6989586621681032539"><span class="hs-identifier hs-var">blocksAcc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-270"></span><span>                </span><span class="annot"><span class="annottext">[SCC (LiveBasicBlock instr)]
</span><a href="#local-6989586621681032536"><span class="hs-identifier hs-var">sccs</span></a></span><span>
</span><span id="line-271"></span><span>
</span><span id="line-272"></span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.html#linearRA_SCCs"><span class="hs-identifier hs-var">linearRA_SCCs</span></a></span><span> </span><span id="local-6989586621681032533"><span class="annot"><span class="annottext">[BlockId]
</span><a href="#local-6989586621681032533"><span class="hs-identifier hs-var">entry_ids</span></a></span></span><span> </span><span id="local-6989586621681032532"><span class="annot"><span class="annottext">BlockMap RegSet
</span><a href="#local-6989586621681032532"><span class="hs-identifier hs-var">block_live</span></a></span></span><span> </span><span id="local-6989586621681032531"><span class="annot"><span class="annottext">[NatBasicBlock instr]
</span><a href="#local-6989586621681032531"><span class="hs-identifier hs-var">blocksAcc</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../containers/src/Data.Graph.html#CyclicSCC"><span class="hs-identifier hs-type">CyclicSCC</span></a></span><span> </span><span id="local-6989586621681032529"><span class="annot"><span class="annottext">[LiveBasicBlock instr]
</span><a href="#local-6989586621681032529"><span class="hs-identifier hs-var">blocks</span></a></span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621681032528"><span class="annot"><span class="annottext">[SCC (LiveBasicBlock instr)]
</span><a href="#local-6989586621681032528"><span class="hs-identifier hs-var">sccs</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-273"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-274"></span><span>        </span><span id="local-6989586621681032527"><span class="annot"><span class="annottext">[[NatBasicBlock instr]]
</span><a href="#local-6989586621681032527"><span class="hs-identifier hs-var">blockss'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[BlockId]
-&gt; BlockMap RegSet
-&gt; [LiveBasicBlock instr]
-&gt; [LiveBasicBlock instr]
-&gt; [[NatBasicBlock instr]]
-&gt; Bool
-&gt; RegM freeRegs [[NatBasicBlock instr]]
forall freeRegs instr.
OutputableRegConstraint freeRegs instr =&gt;
[BlockId]
-&gt; BlockMap RegSet
-&gt; [GenBasicBlock (LiveInstr instr)]
-&gt; [GenBasicBlock (LiveInstr instr)]
-&gt; [[NatBasicBlock instr]]
-&gt; Bool
-&gt; RegM freeRegs [[NatBasicBlock instr]]
</span><a href="GHC.CmmToAsm.Reg.Linear.html#process"><span class="hs-identifier hs-var">process</span></a></span><span> </span><span class="annot"><span class="annottext">[BlockId]
</span><a href="#local-6989586621681032533"><span class="hs-identifier hs-var">entry_ids</span></a></span><span> </span><span class="annot"><span class="annottext">BlockMap RegSet
</span><a href="#local-6989586621681032532"><span class="hs-identifier hs-var">block_live</span></a></span><span> </span><span class="annot"><span class="annottext">[LiveBasicBlock instr]
</span><a href="#local-6989586621681032529"><span class="hs-identifier hs-var">blocks</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[NatBasicBlock instr] -&gt; [[NatBasicBlock instr]]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-275"></span><span>        </span><span class="annot"><span class="annottext">[BlockId]
-&gt; BlockMap RegSet
-&gt; [NatBasicBlock instr]
-&gt; [SCC (LiveBasicBlock instr)]
-&gt; RegM freeRegs [NatBasicBlock instr]
forall freeRegs instr.
OutputableRegConstraint freeRegs instr =&gt;
[BlockId]
-&gt; BlockMap RegSet
-&gt; [NatBasicBlock instr]
-&gt; [SCC (LiveBasicBlock instr)]
-&gt; RegM freeRegs [NatBasicBlock instr]
</span><a href="GHC.CmmToAsm.Reg.Linear.html#linearRA_SCCs"><span class="hs-identifier hs-var">linearRA_SCCs</span></a></span><span> </span><span class="annot"><span class="annottext">[BlockId]
</span><a href="#local-6989586621681032533"><span class="hs-identifier hs-var">entry_ids</span></a></span><span> </span><span class="annot"><span class="annottext">BlockMap RegSet
</span><a href="#local-6989586621681032532"><span class="hs-identifier hs-var">block_live</span></a></span><span>
</span><span id="line-276"></span><span>                </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[NatBasicBlock instr] -&gt; [NatBasicBlock instr]
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[[NatBasicBlock instr]] -&gt; [NatBasicBlock instr]
forall (t :: * -&gt; *) a. Foldable t =&gt; t [a] -&gt; [a]
</span><a href="../../base/src/Data.Foldable.html#concat"><span class="hs-identifier hs-var">concat</span></a></span><span> </span><span class="annot"><span class="annottext">[[NatBasicBlock instr]]
</span><a href="#local-6989586621681032527"><span class="hs-identifier hs-var">blockss'</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[NatBasicBlock instr]
-&gt; [NatBasicBlock instr] -&gt; [NatBasicBlock instr]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[NatBasicBlock instr]
</span><a href="#local-6989586621681032531"><span class="hs-identifier hs-var">blocksAcc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-277"></span><span>                </span><span class="annot"><span class="annottext">[SCC (LiveBasicBlock instr)]
</span><a href="#local-6989586621681032528"><span class="hs-identifier hs-var">sccs</span></a></span><span>
</span><span id="line-278"></span><span>
</span><span id="line-279"></span><span class="hs-comment">{- from John Dias's patch 2008/10/16:
   The linear-scan allocator sometimes allocates a block
   before allocating one of its predecessors, which could lead to
   inconsistent allocations. Make it so a block is only allocated
   if a predecessor has set the &quot;incoming&quot; assignments for the block, or
   if it's the procedure's entry block.

   BL 2009/02: Careful. If the assignment for a block doesn't get set for
   some reason then this function will loop. We should probably do some
   more sanity checking to guard against this eventuality.
-}</span><span>
</span><span id="line-290"></span><span>
</span><span id="line-291"></span><span id="local-6989586621681032836"><span id="local-6989586621681032837"><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.html#process"><span class="hs-identifier hs-type">process</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.html#OutputableRegConstraint"><span class="hs-identifier hs-type">OutputableRegConstraint</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032837"><span class="hs-identifier hs-type">freeRegs</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032836"><span class="hs-identifier hs-type">instr</span></a></span><span>
</span><span id="line-292"></span><span>        </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Cmm.BlockId.html#BlockId"><span class="hs-identifier hs-type">BlockId</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-293"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#BlockMap"><span class="hs-identifier hs-type">BlockMap</span></a></span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#RegSet"><span class="hs-identifier hs-type">RegSet</span></a></span><span>
</span><span id="line-294"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Cmm.html#GenBasicBlock"><span class="hs-identifier hs-type">GenBasicBlock</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#LiveInstr"><span class="hs-identifier hs-type">LiveInstr</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032836"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-295"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Cmm.html#GenBasicBlock"><span class="hs-identifier hs-type">GenBasicBlock</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#LiveInstr"><span class="hs-identifier hs-type">LiveInstr</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032836"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-296"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">[</span><span class="annot"><a href="GHC.CmmToAsm.Instr.html#NatBasicBlock"><span class="hs-identifier hs-type">NatBasicBlock</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032836"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">]</span><span class="hs-special">]</span><span>
</span><span id="line-297"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-298"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.State.html#RegM"><span class="hs-identifier hs-type">RegM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032837"><span class="hs-identifier hs-type">freeRegs</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">[</span><span class="annot"><a href="GHC.CmmToAsm.Instr.html#NatBasicBlock"><span class="hs-identifier hs-type">NatBasicBlock</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032836"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">]</span><span class="hs-special">]</span></span></span><span>
</span><span id="line-299"></span><span>
</span><span id="line-300"></span><span id="process"><span class="annot"><span class="annottext">process :: forall freeRegs instr.
OutputableRegConstraint freeRegs instr =&gt;
[BlockId]
-&gt; BlockMap RegSet
-&gt; [GenBasicBlock (LiveInstr instr)]
-&gt; [GenBasicBlock (LiveInstr instr)]
-&gt; [[NatBasicBlock instr]]
-&gt; Bool
-&gt; RegM freeRegs [[NatBasicBlock instr]]
</span><a href="GHC.CmmToAsm.Reg.Linear.html#process"><span class="hs-identifier hs-var hs-var">process</span></a></span></span><span> </span><span class="annot"><span class="annottext">[BlockId]
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">BlockMap RegSet
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>         </span><span id="local-6989586621681032513"><span class="annot"><span class="annottext">[[NatBasicBlock instr]]
</span><a href="#local-6989586621681032513"><span class="hs-identifier hs-var">accum</span></a></span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier">_</span></span><span>
</span><span id="line-301"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[[NatBasicBlock instr]] -&gt; RegM freeRegs [[NatBasicBlock instr]]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">([[NatBasicBlock instr]] -&gt; RegM freeRegs [[NatBasicBlock instr]])
-&gt; [[NatBasicBlock instr]] -&gt; RegM freeRegs [[NatBasicBlock instr]]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[[NatBasicBlock instr]] -&gt; [[NatBasicBlock instr]]
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="annot"><span class="annottext">[[NatBasicBlock instr]]
</span><a href="#local-6989586621681032513"><span class="hs-identifier hs-var">accum</span></a></span><span>
</span><span id="line-302"></span><span>
</span><span id="line-303"></span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.html#process"><span class="hs-identifier hs-var">process</span></a></span><span> </span><span id="local-6989586621681032512"><span class="annot"><span class="annottext">[BlockId]
</span><a href="#local-6989586621681032512"><span class="hs-identifier hs-var">entry_ids</span></a></span></span><span> </span><span id="local-6989586621681032511"><span class="annot"><span class="annottext">BlockMap RegSet
</span><a href="#local-6989586621681032511"><span class="hs-identifier hs-var">block_live</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span id="local-6989586621681032510"><span class="annot"><span class="annottext">[GenBasicBlock (LiveInstr instr)]
</span><a href="#local-6989586621681032510"><span class="hs-identifier hs-var">next_round</span></a></span></span><span> </span><span id="local-6989586621681032509"><span class="annot"><span class="annottext">[[NatBasicBlock instr]]
</span><a href="#local-6989586621681032509"><span class="hs-identifier hs-var">accum</span></a></span></span><span> </span><span id="local-6989586621681032508"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681032508"><span class="hs-identifier hs-var">madeProgress</span></a></span></span><span>
</span><span id="line-304"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681032508"><span class="hs-identifier hs-var">madeProgress</span></a></span><span>
</span><span id="line-305"></span><span>
</span><span id="line-306"></span><span>          </span><span class="hs-comment">{- BUGS: There are so many unreachable blocks in the code the warnings are overwhelming.
             pprTrace &quot;RegAlloc.Linear.Main.process: no progress made, bailing out.&quot;
                (  text &quot;Unreachable blocks:&quot;
                $$ vcat (map ppr next_round)) -}</span><span>
</span><span id="line-310"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[[NatBasicBlock instr]] -&gt; RegM freeRegs [[NatBasicBlock instr]]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">([[NatBasicBlock instr]] -&gt; RegM freeRegs [[NatBasicBlock instr]])
-&gt; [[NatBasicBlock instr]] -&gt; RegM freeRegs [[NatBasicBlock instr]]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[[NatBasicBlock instr]] -&gt; [[NatBasicBlock instr]]
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="annot"><span class="annottext">[[NatBasicBlock instr]]
</span><a href="#local-6989586621681032509"><span class="hs-identifier hs-var">accum</span></a></span><span>
</span><span id="line-311"></span><span>
</span><span id="line-312"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-313"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[BlockId]
-&gt; BlockMap RegSet
-&gt; [GenBasicBlock (LiveInstr instr)]
-&gt; [GenBasicBlock (LiveInstr instr)]
-&gt; [[NatBasicBlock instr]]
-&gt; Bool
-&gt; RegM freeRegs [[NatBasicBlock instr]]
forall freeRegs instr.
OutputableRegConstraint freeRegs instr =&gt;
[BlockId]
-&gt; BlockMap RegSet
-&gt; [GenBasicBlock (LiveInstr instr)]
-&gt; [GenBasicBlock (LiveInstr instr)]
-&gt; [[NatBasicBlock instr]]
-&gt; Bool
-&gt; RegM freeRegs [[NatBasicBlock instr]]
</span><a href="GHC.CmmToAsm.Reg.Linear.html#process"><span class="hs-identifier hs-var">process</span></a></span><span> </span><span class="annot"><span class="annottext">[BlockId]
</span><a href="#local-6989586621681032512"><span class="hs-identifier hs-var">entry_ids</span></a></span><span> </span><span class="annot"><span class="annottext">BlockMap RegSet
</span><a href="#local-6989586621681032511"><span class="hs-identifier hs-var">block_live</span></a></span><span>
</span><span id="line-314"></span><span>                  </span><span class="annot"><span class="annottext">[GenBasicBlock (LiveInstr instr)]
</span><a href="#local-6989586621681032510"><span class="hs-identifier hs-var">next_round</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">[[NatBasicBlock instr]]
</span><a href="#local-6989586621681032509"><span class="hs-identifier hs-var">accum</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-315"></span><span>
</span><span id="line-316"></span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.html#process"><span class="hs-identifier hs-var">process</span></a></span><span> </span><span id="local-6989586621681032506"><span class="annot"><span class="annottext">[BlockId]
</span><a href="#local-6989586621681032506"><span class="hs-identifier hs-var">entry_ids</span></a></span></span><span> </span><span id="local-6989586621681032505"><span class="annot"><span class="annottext">BlockMap RegSet
</span><a href="#local-6989586621681032505"><span class="hs-identifier hs-var">block_live</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681032504"><span class="annot"><span class="annottext">b :: GenBasicBlock (LiveInstr instr)
</span><a href="#local-6989586621681032504"><span class="hs-identifier hs-var">b</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Cmm.html#BasicBlock"><span class="hs-identifier hs-type">BasicBlock</span></a></span><span> </span><span id="local-6989586621681032502"><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681032502"><span class="hs-identifier hs-var">id</span></a></span></span><span> </span><span class="annot"><span class="annottext">[LiveInstr instr]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621681032501"><span class="annot"><span class="annottext">[GenBasicBlock (LiveInstr instr)]
</span><a href="#local-6989586621681032501"><span class="hs-identifier hs-var">blocks</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-317"></span><span>        </span><span id="local-6989586621681032500"><span class="annot"><span class="annottext">[GenBasicBlock (LiveInstr instr)]
</span><a href="#local-6989586621681032500"><span class="hs-identifier hs-var">next_round</span></a></span></span><span> </span><span id="local-6989586621681032499"><span class="annot"><span class="annottext">[[NatBasicBlock instr]]
</span><a href="#local-6989586621681032499"><span class="hs-identifier hs-var">accum</span></a></span></span><span> </span><span id="local-6989586621681032498"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681032498"><span class="hs-identifier hs-var">madeProgress</span></a></span></span><span>
</span><span id="line-318"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-319"></span><span>        </span><span id="local-6989586621681032497"><span class="annot"><span class="annottext">BlockAssignment freeRegs
</span><a href="#local-6989586621681032497"><span class="hs-identifier hs-var">block_assig</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">RegM freeRegs (BlockAssignment freeRegs)
forall freeRegs. RegM freeRegs (BlockAssignment freeRegs)
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#getBlockAssigR"><span class="hs-identifier hs-var">getBlockAssigR</span></a></span><span>
</span><span id="line-320"></span><span>
</span><span id="line-321"></span><span>        </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Maybe (freeRegs, RegMap Loc) -&gt; Bool
forall a. Maybe a -&gt; Bool
</span><a href="../../base/src/Data.Maybe.html#isJust"><span class="hs-identifier hs-var">isJust</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">BlockId -&gt; BlockAssignment freeRegs -&gt; Maybe (freeRegs, RegMap Loc)
forall freeRegs.
BlockId -&gt; BlockAssignment freeRegs -&gt; Maybe (freeRegs, RegMap Loc)
</span><a href="GHC.CmmToAsm.Reg.Linear.Base.html#lookupBlockAssignment"><span class="hs-identifier hs-var">lookupBlockAssignment</span></a></span><span> </span><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681032502"><span class="hs-identifier hs-var">id</span></a></span><span> </span><span class="annot"><span class="annottext">BlockAssignment freeRegs
</span><a href="#local-6989586621681032497"><span class="hs-identifier hs-var">block_assig</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-322"></span><span>             </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681032502"><span class="hs-identifier hs-var">id</span></a></span><span> </span><span class="annot"><span class="annottext">BlockId -&gt; [BlockId] -&gt; Bool
forall (t :: * -&gt; *) a. (Foldable t, Eq a) =&gt; a -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#elem"><span class="hs-operator hs-var">`elem`</span></a></span><span> </span><span class="annot"><span class="annottext">[BlockId]
</span><a href="#local-6989586621681032506"><span class="hs-identifier hs-var">entry_ids</span></a></span><span>
</span><span id="line-323"></span><span>         </span><span class="hs-keyword">then</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-324"></span><span>                </span><span id="local-6989586621681032491"><span class="annot"><span class="annottext">[NatBasicBlock instr]
</span><a href="#local-6989586621681032491"><span class="hs-identifier hs-var">b'</span></a></span></span><span>  </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">BlockMap RegSet
-&gt; GenBasicBlock (LiveInstr instr)
-&gt; RegM freeRegs [NatBasicBlock instr]
forall freeRegs instr.
OutputableRegConstraint freeRegs instr =&gt;
BlockMap RegSet
-&gt; LiveBasicBlock instr -&gt; RegM freeRegs [NatBasicBlock instr]
</span><a href="GHC.CmmToAsm.Reg.Linear.html#processBlock"><span class="hs-identifier hs-var">processBlock</span></a></span><span> </span><span class="annot"><span class="annottext">BlockMap RegSet
</span><a href="#local-6989586621681032505"><span class="hs-identifier hs-var">block_live</span></a></span><span> </span><span class="annot"><span class="annottext">GenBasicBlock (LiveInstr instr)
</span><a href="#local-6989586621681032504"><span class="hs-identifier hs-var">b</span></a></span><span>
</span><span id="line-325"></span><span>                </span><span class="annot"><span class="annottext">[BlockId]
-&gt; BlockMap RegSet
-&gt; [GenBasicBlock (LiveInstr instr)]
-&gt; [GenBasicBlock (LiveInstr instr)]
-&gt; [[NatBasicBlock instr]]
-&gt; Bool
-&gt; RegM freeRegs [[NatBasicBlock instr]]
forall freeRegs instr.
OutputableRegConstraint freeRegs instr =&gt;
[BlockId]
-&gt; BlockMap RegSet
-&gt; [GenBasicBlock (LiveInstr instr)]
-&gt; [GenBasicBlock (LiveInstr instr)]
-&gt; [[NatBasicBlock instr]]
-&gt; Bool
-&gt; RegM freeRegs [[NatBasicBlock instr]]
</span><a href="GHC.CmmToAsm.Reg.Linear.html#process"><span class="hs-identifier hs-var">process</span></a></span><span> </span><span class="annot"><span class="annottext">[BlockId]
</span><a href="#local-6989586621681032506"><span class="hs-identifier hs-var">entry_ids</span></a></span><span> </span><span class="annot"><span class="annottext">BlockMap RegSet
</span><a href="#local-6989586621681032505"><span class="hs-identifier hs-var">block_live</span></a></span><span> </span><span class="annot"><span class="annottext">[GenBasicBlock (LiveInstr instr)]
</span><a href="#local-6989586621681032501"><span class="hs-identifier hs-var">blocks</span></a></span><span>
</span><span id="line-326"></span><span>                        </span><span class="annot"><span class="annottext">[GenBasicBlock (LiveInstr instr)]
</span><a href="#local-6989586621681032500"><span class="hs-identifier hs-var">next_round</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[NatBasicBlock instr]
</span><a href="#local-6989586621681032491"><span class="hs-identifier hs-var">b'</span></a></span><span> </span><span class="annot"><span class="annottext">[NatBasicBlock instr]
-&gt; [[NatBasicBlock instr]] -&gt; [[NatBasicBlock instr]]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[[NatBasicBlock instr]]
</span><a href="#local-6989586621681032499"><span class="hs-identifier hs-var">accum</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-327"></span><span>
</span><span id="line-328"></span><span>         </span><span class="hs-keyword">else</span><span>   </span><span class="annot"><span class="annottext">[BlockId]
-&gt; BlockMap RegSet
-&gt; [GenBasicBlock (LiveInstr instr)]
-&gt; [GenBasicBlock (LiveInstr instr)]
-&gt; [[NatBasicBlock instr]]
-&gt; Bool
-&gt; RegM freeRegs [[NatBasicBlock instr]]
forall freeRegs instr.
OutputableRegConstraint freeRegs instr =&gt;
[BlockId]
-&gt; BlockMap RegSet
-&gt; [GenBasicBlock (LiveInstr instr)]
-&gt; [GenBasicBlock (LiveInstr instr)]
-&gt; [[NatBasicBlock instr]]
-&gt; Bool
-&gt; RegM freeRegs [[NatBasicBlock instr]]
</span><a href="GHC.CmmToAsm.Reg.Linear.html#process"><span class="hs-identifier hs-var">process</span></a></span><span> </span><span class="annot"><span class="annottext">[BlockId]
</span><a href="#local-6989586621681032506"><span class="hs-identifier hs-var">entry_ids</span></a></span><span> </span><span class="annot"><span class="annottext">BlockMap RegSet
</span><a href="#local-6989586621681032505"><span class="hs-identifier hs-var">block_live</span></a></span><span> </span><span class="annot"><span class="annottext">[GenBasicBlock (LiveInstr instr)]
</span><a href="#local-6989586621681032501"><span class="hs-identifier hs-var">blocks</span></a></span><span>
</span><span id="line-329"></span><span>                        </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GenBasicBlock (LiveInstr instr)
</span><a href="#local-6989586621681032504"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="annot"><span class="annottext">GenBasicBlock (LiveInstr instr)
-&gt; [GenBasicBlock (LiveInstr instr)]
-&gt; [GenBasicBlock (LiveInstr instr)]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[GenBasicBlock (LiveInstr instr)]
</span><a href="#local-6989586621681032500"><span class="hs-identifier hs-var">next_round</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[[NatBasicBlock instr]]
</span><a href="#local-6989586621681032499"><span class="hs-identifier hs-var">accum</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681032498"><span class="hs-identifier hs-var">madeProgress</span></a></span><span>
</span><span id="line-330"></span><span>
</span><span id="line-331"></span><span>
</span><span id="line-332"></span><span class="hs-comment">-- | Do register allocation on this basic block</span><span>
</span><span id="line-333"></span><span class="hs-comment">--</span><span>
</span><span id="line-334"></span><span id="local-6989586621681032839"><span id="local-6989586621681032840"><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.html#processBlock"><span class="hs-identifier hs-type">processBlock</span></a></span><span>
</span><span id="line-335"></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.html#OutputableRegConstraint"><span class="hs-identifier hs-type">OutputableRegConstraint</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032840"><span class="hs-identifier hs-type">freeRegs</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032839"><span class="hs-identifier hs-type">instr</span></a></span><span>
</span><span id="line-336"></span><span>        </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#BlockMap"><span class="hs-identifier hs-type">BlockMap</span></a></span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#RegSet"><span class="hs-identifier hs-type">RegSet</span></a></span><span>              </span><span class="hs-comment">-- ^ live regs on entry to each basic block</span><span>
</span><span id="line-337"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#LiveBasicBlock"><span class="hs-identifier hs-type">LiveBasicBlock</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032839"><span class="hs-identifier hs-type">instr</span></a></span><span>         </span><span class="hs-comment">-- ^ block to do register allocation on</span><span>
</span><span id="line-338"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.State.html#RegM"><span class="hs-identifier hs-type">RegM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032840"><span class="hs-identifier hs-type">freeRegs</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.CmmToAsm.Instr.html#NatBasicBlock"><span class="hs-identifier hs-type">NatBasicBlock</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032839"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">]</span></span></span><span>   </span><span class="hs-comment">-- ^ block with registers allocated</span><span>
</span><span id="line-339"></span><span>
</span><span id="line-340"></span><span id="processBlock"><span class="annot"><span class="annottext">processBlock :: forall freeRegs instr.
OutputableRegConstraint freeRegs instr =&gt;
BlockMap RegSet
-&gt; LiveBasicBlock instr -&gt; RegM freeRegs [NatBasicBlock instr]
</span><a href="GHC.CmmToAsm.Reg.Linear.html#processBlock"><span class="hs-identifier hs-var hs-var">processBlock</span></a></span></span><span> </span><span id="local-6989586621681032483"><span class="annot"><span class="annottext">BlockMap RegSet
</span><a href="#local-6989586621681032483"><span class="hs-identifier hs-var">block_live</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Cmm.html#BasicBlock"><span class="hs-identifier hs-type">BasicBlock</span></a></span><span> </span><span id="local-6989586621681032482"><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681032482"><span class="hs-identifier hs-var">id</span></a></span></span><span> </span><span id="local-6989586621681032481"><span class="annot"><span class="annottext">[LiveInstr instr]
</span><a href="#local-6989586621681032481"><span class="hs-identifier hs-var">instrs</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-341"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>   </span><span class="hs-comment">-- pprTraceM &quot;processBlock&quot; $ text &quot;&quot; $$ ppr (BasicBlock id instrs)</span><span>
</span><span id="line-342"></span><span>        </span><span class="annot"><span class="annottext">BlockId -&gt; BlockMap RegSet -&gt; RegM freeRegs ()
forall freeRegs.
FR freeRegs =&gt;
BlockId -&gt; BlockMap RegSet -&gt; RegM freeRegs ()
</span><a href="GHC.CmmToAsm.Reg.Linear.html#initBlock"><span class="hs-identifier hs-var">initBlock</span></a></span><span> </span><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681032482"><span class="hs-identifier hs-var">id</span></a></span><span> </span><span class="annot"><span class="annottext">BlockMap RegSet
</span><a href="#local-6989586621681032483"><span class="hs-identifier hs-var">block_live</span></a></span><span>
</span><span id="line-343"></span><span>
</span><span id="line-344"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621681032479"><span class="annot"><span class="annottext">[instr]
</span><a href="#local-6989586621681032479"><span class="hs-identifier hs-var">instrs'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681032478"><span class="annot"><span class="annottext">[NatBasicBlock instr]
</span><a href="#local-6989586621681032478"><span class="hs-identifier hs-var">fixups</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-345"></span><span>                </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">BlockMap RegSet
-&gt; [instr]
-&gt; [NatBasicBlock instr]
-&gt; BlockId
-&gt; [LiveInstr instr]
-&gt; RegM freeRegs ([instr], [NatBasicBlock instr])
forall freeRegs instr.
OutputableRegConstraint freeRegs instr =&gt;
BlockMap RegSet
-&gt; [instr]
-&gt; [NatBasicBlock instr]
-&gt; BlockId
-&gt; [LiveInstr instr]
-&gt; RegM freeRegs ([instr], [NatBasicBlock instr])
</span><a href="GHC.CmmToAsm.Reg.Linear.html#linearRA"><span class="hs-identifier hs-var">linearRA</span></a></span><span> </span><span class="annot"><span class="annottext">BlockMap RegSet
</span><a href="#local-6989586621681032483"><span class="hs-identifier hs-var">block_live</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681032482"><span class="hs-identifier hs-var">id</span></a></span><span> </span><span class="annot"><span class="annottext">[LiveInstr instr]
</span><a href="#local-6989586621681032481"><span class="hs-identifier hs-var">instrs</span></a></span><span>
</span><span id="line-346"></span><span>        </span><span class="hs-comment">-- pprTraceM &quot;blockResult&quot; $ ppr (instrs', fixups)</span><span>
</span><span id="line-347"></span><span>        </span><span class="annot"><span class="annottext">[NatBasicBlock instr] -&gt; RegM freeRegs [NatBasicBlock instr]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span>  </span><span class="annot"><span class="annottext">([NatBasicBlock instr] -&gt; RegM freeRegs [NatBasicBlock instr])
-&gt; [NatBasicBlock instr] -&gt; RegM freeRegs [NatBasicBlock instr]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">BlockId -&gt; [instr] -&gt; NatBasicBlock instr
forall i. BlockId -&gt; [i] -&gt; GenBasicBlock i
</span><a href="GHC.Cmm.html#BasicBlock"><span class="hs-identifier hs-var">BasicBlock</span></a></span><span> </span><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681032482"><span class="hs-identifier hs-var">id</span></a></span><span> </span><span class="annot"><span class="annottext">[instr]
</span><a href="#local-6989586621681032479"><span class="hs-identifier hs-var">instrs'</span></a></span><span> </span><span class="annot"><span class="annottext">NatBasicBlock instr
-&gt; [NatBasicBlock instr] -&gt; [NatBasicBlock instr]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[NatBasicBlock instr]
</span><a href="#local-6989586621681032478"><span class="hs-identifier hs-var">fixups</span></a></span><span>
</span><span id="line-348"></span><span>
</span><span id="line-349"></span><span>
</span><span id="line-350"></span><span class="hs-comment">-- | Load the freeregs and current reg assignment into the RegM state</span><span>
</span><span id="line-351"></span><span class="hs-comment">--      for the basic block with this BlockId.</span><span>
</span><span id="line-352"></span><span id="local-6989586621681032823"><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.html#initBlock"><span class="hs-identifier hs-type">initBlock</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.FreeRegs.html#FR"><span class="hs-identifier hs-type">FR</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032823"><span class="hs-identifier hs-type">freeRegs</span></a></span><span>
</span><span id="line-353"></span><span>          </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Cmm.BlockId.html#BlockId"><span class="hs-identifier hs-type">BlockId</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#BlockMap"><span class="hs-identifier hs-type">BlockMap</span></a></span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#RegSet"><span class="hs-identifier hs-type">RegSet</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.State.html#RegM"><span class="hs-identifier hs-type">RegM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032823"><span class="hs-identifier hs-type">freeRegs</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span></span><span>
</span><span id="line-354"></span><span id="initBlock"><span class="annot"><span class="annottext">initBlock :: forall freeRegs.
FR freeRegs =&gt;
BlockId -&gt; BlockMap RegSet -&gt; RegM freeRegs ()
</span><a href="GHC.CmmToAsm.Reg.Linear.html#initBlock"><span class="hs-identifier hs-var hs-var">initBlock</span></a></span></span><span> </span><span id="local-6989586621681032465"><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681032465"><span class="hs-identifier hs-var">id</span></a></span></span><span> </span><span id="local-6989586621681032464"><span class="annot"><span class="annottext">BlockMap RegSet
</span><a href="#local-6989586621681032464"><span class="hs-identifier hs-var">block_live</span></a></span></span><span>
</span><span id="line-355"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>   </span><span id="local-6989586621681032463"><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681032463"><span class="hs-identifier hs-var">platform</span></a></span></span><span>    </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">RegM freeRegs Platform
forall a. RegM a Platform
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#getPlatform"><span class="hs-identifier hs-var">getPlatform</span></a></span><span>
</span><span id="line-356"></span><span>        </span><span id="local-6989586621681032461"><span class="annot"><span class="annottext">BlockAssignment freeRegs
</span><a href="#local-6989586621681032461"><span class="hs-identifier hs-var">block_assig</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">RegM freeRegs (BlockAssignment freeRegs)
forall freeRegs. RegM freeRegs (BlockAssignment freeRegs)
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#getBlockAssigR"><span class="hs-identifier hs-var">getBlockAssigR</span></a></span><span>
</span><span id="line-357"></span><span>        </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">BlockId -&gt; BlockAssignment freeRegs -&gt; Maybe (freeRegs, RegMap Loc)
forall freeRegs.
BlockId -&gt; BlockAssignment freeRegs -&gt; Maybe (freeRegs, RegMap Loc)
</span><a href="GHC.CmmToAsm.Reg.Linear.Base.html#lookupBlockAssignment"><span class="hs-identifier hs-var">lookupBlockAssignment</span></a></span><span> </span><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681032465"><span class="hs-identifier hs-var">id</span></a></span><span> </span><span class="annot"><span class="annottext">BlockAssignment freeRegs
</span><a href="#local-6989586621681032461"><span class="hs-identifier hs-var">block_assig</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-358"></span><span>                </span><span class="hs-comment">-- no prior info about this block: we must consider</span><span>
</span><span id="line-359"></span><span>                </span><span class="hs-comment">-- any fixed regs to be allocated, but we can ignore</span><span>
</span><span id="line-360"></span><span>                </span><span class="hs-comment">-- virtual regs (presumably this is part of a loop,</span><span>
</span><span id="line-361"></span><span>                </span><span class="hs-comment">-- and we'll iterate again).  The assignment begins</span><span>
</span><span id="line-362"></span><span>                </span><span class="hs-comment">-- empty.</span><span>
</span><span id="line-363"></span><span>                </span><span class="annot"><span class="annottext">Maybe (freeRegs, RegMap Loc)
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-364"></span><span>                 </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>  </span><span class="hs-comment">-- pprTrace &quot;initFreeRegs&quot; (text $ show initFreeRegs) (return ())</span><span>
</span><span id="line-365"></span><span>                        </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">KeyOf LabelMap -&gt; BlockMap RegSet -&gt; Maybe RegSet
forall (map :: * -&gt; *) a.
IsMap map =&gt;
KeyOf map -&gt; map a -&gt; Maybe a
</span><a href="GHC.Cmm.Dataflow.Collections.html#mapLookup"><span class="hs-identifier hs-var">mapLookup</span></a></span><span> </span><span class="annot"><span class="annottext">KeyOf LabelMap
BlockId
</span><a href="#local-6989586621681032465"><span class="hs-identifier hs-var">id</span></a></span><span> </span><span class="annot"><span class="annottext">BlockMap RegSet
</span><a href="#local-6989586621681032464"><span class="hs-identifier hs-var">block_live</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-366"></span><span>                          </span><span class="annot"><span class="annottext">Maybe RegSet
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-367"></span><span>                            </span><span class="annot"><span class="annottext">freeRegs -&gt; RegM freeRegs ()
forall freeRegs. freeRegs -&gt; RegM freeRegs ()
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#setFreeRegsR"><span class="hs-identifier hs-var">setFreeRegsR</span></a></span><span>    </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform -&gt; freeRegs
forall freeRegs. FR freeRegs =&gt; Platform -&gt; freeRegs
</span><a href="GHC.CmmToAsm.Reg.Linear.FreeRegs.html#frInitFreeRegs"><span class="hs-identifier hs-var">frInitFreeRegs</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681032463"><span class="hs-identifier hs-var">platform</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-368"></span><span>                          </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681032458"><span class="annot"><span class="annottext">RegSet
</span><a href="#local-6989586621681032458"><span class="hs-identifier hs-var">live</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-369"></span><span>                            </span><span class="annot"><span class="annottext">freeRegs -&gt; RegM freeRegs ()
forall freeRegs. freeRegs -&gt; RegM freeRegs ()
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#setFreeRegsR"><span class="hs-identifier hs-var">setFreeRegsR</span></a></span><span> </span><span class="annot"><span class="annottext">(freeRegs -&gt; RegM freeRegs ()) -&gt; freeRegs -&gt; RegM freeRegs ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(freeRegs -&gt; RealReg -&gt; freeRegs)
-&gt; freeRegs -&gt; [RealReg] -&gt; freeRegs
forall (t :: * -&gt; *) b a.
Foldable t =&gt;
(b -&gt; a -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldl%27"><span class="hs-identifier hs-var">foldl'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(RealReg -&gt; freeRegs -&gt; freeRegs)
-&gt; freeRegs -&gt; RealReg -&gt; freeRegs
forall a b c. (a -&gt; b -&gt; c) -&gt; b -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#flip"><span class="hs-identifier hs-var">flip</span></a></span><span> </span><span class="annot"><span class="annottext">((RealReg -&gt; freeRegs -&gt; freeRegs)
 -&gt; freeRegs -&gt; RealReg -&gt; freeRegs)
-&gt; (RealReg -&gt; freeRegs -&gt; freeRegs)
-&gt; freeRegs
-&gt; RealReg
-&gt; freeRegs
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Platform -&gt; RealReg -&gt; freeRegs -&gt; freeRegs
forall freeRegs.
FR freeRegs =&gt;
Platform -&gt; RealReg -&gt; freeRegs -&gt; freeRegs
</span><a href="GHC.CmmToAsm.Reg.Linear.FreeRegs.html#frAllocateReg"><span class="hs-identifier hs-var">frAllocateReg</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681032463"><span class="hs-identifier hs-var">platform</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform -&gt; freeRegs
forall freeRegs. FR freeRegs =&gt; Platform -&gt; freeRegs
</span><a href="GHC.CmmToAsm.Reg.Linear.FreeRegs.html#frInitFreeRegs"><span class="hs-identifier hs-var">frInitFreeRegs</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681032463"><span class="hs-identifier hs-var">platform</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-370"></span><span>                                                  </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032454"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#RegReal"><span class="hs-identifier hs-type">RegReal</span></a></span><span> </span><span id="local-6989586621681032454"><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032454"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">RegSet -&gt; [Reg]
forall elt. UniqSet elt -&gt; [elt]
</span><a href="GHC.Types.Unique.Set.html#nonDetEltsUniqSet"><span class="hs-identifier hs-var">nonDetEltsUniqSet</span></a></span><span> </span><span class="annot"><span class="annottext">RegSet
</span><a href="#local-6989586621681032458"><span class="hs-identifier hs-var">live</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-371"></span><span>                            </span><span class="hs-comment">-- See Note [Unique Determinism and code generation]</span><span>
</span><span id="line-372"></span><span>                        </span><span class="annot"><span class="annottext">RegMap Loc -&gt; RegM freeRegs ()
forall freeRegs. RegMap Loc -&gt; RegM freeRegs ()
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#setAssigR"><span class="hs-identifier hs-var">setAssigR</span></a></span><span>       </span><span class="annot"><span class="annottext">RegMap Loc
forall a. RegMap a
</span><a href="GHC.CmmToAsm.Reg.Liveness.html#emptyRegMap"><span class="hs-identifier hs-var">emptyRegMap</span></a></span><span>
</span><span id="line-373"></span><span>
</span><span id="line-374"></span><span>                </span><span class="hs-comment">-- load info about register assignments leading into this block.</span><span>
</span><span id="line-375"></span><span>                </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681032450"><span class="annot"><span class="annottext">freeRegs
</span><a href="#local-6989586621681032450"><span class="hs-identifier hs-var">freeregs</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681032449"><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681032449"><span class="hs-identifier hs-var">assig</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-376"></span><span>                 </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>  </span><span class="annot"><span class="annottext">freeRegs -&gt; RegM freeRegs ()
forall freeRegs. freeRegs -&gt; RegM freeRegs ()
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#setFreeRegsR"><span class="hs-identifier hs-var">setFreeRegsR</span></a></span><span>    </span><span class="annot"><span class="annottext">freeRegs
</span><a href="#local-6989586621681032450"><span class="hs-identifier hs-var">freeregs</span></a></span><span>
</span><span id="line-377"></span><span>                        </span><span class="annot"><span class="annottext">RegMap Loc -&gt; RegM freeRegs ()
forall freeRegs. RegMap Loc -&gt; RegM freeRegs ()
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#setAssigR"><span class="hs-identifier hs-var">setAssigR</span></a></span><span>       </span><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681032449"><span class="hs-identifier hs-var">assig</span></a></span><span>
</span><span id="line-378"></span><span>
</span><span id="line-379"></span><span>
</span><span id="line-380"></span><span class="hs-comment">-- | Do allocation for a sequence of instructions.</span><span>
</span><span id="line-381"></span><span id="local-6989586621681032821"><span id="local-6989586621681032822"><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.html#linearRA"><span class="hs-identifier hs-type">linearRA</span></a></span><span>
</span><span id="line-382"></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.html#OutputableRegConstraint"><span class="hs-identifier hs-type">OutputableRegConstraint</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032822"><span class="hs-identifier hs-type">freeRegs</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032821"><span class="hs-identifier hs-type">instr</span></a></span><span>
</span><span id="line-383"></span><span>        </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#BlockMap"><span class="hs-identifier hs-type">BlockMap</span></a></span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#RegSet"><span class="hs-identifier hs-type">RegSet</span></a></span><span>                      </span><span class="hs-comment">-- ^ map of what vregs are live on entry to each block.</span><span>
</span><span id="line-384"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621681032821"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">]</span><span>                              </span><span class="hs-comment">-- ^ accumulator for instructions already processed.</span><span>
</span><span id="line-385"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.CmmToAsm.Instr.html#NatBasicBlock"><span class="hs-identifier hs-type">NatBasicBlock</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032821"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">]</span><span>                </span><span class="hs-comment">-- ^ accumulator for blocks of fixup code.</span><span>
</span><span id="line-386"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Cmm.BlockId.html#BlockId"><span class="hs-identifier hs-type">BlockId</span></a></span><span>                              </span><span class="hs-comment">-- ^ id of the current block, for debugging.</span><span>
</span><span id="line-387"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#LiveInstr"><span class="hs-identifier hs-type">LiveInstr</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032821"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">]</span><span>                    </span><span class="hs-comment">-- ^ liveness annotated instructions in this block.</span><span>
</span><span id="line-388"></span><span>
</span><span id="line-389"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.State.html#RegM"><span class="hs-identifier hs-type">RegM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032822"><span class="hs-identifier hs-type">freeRegs</span></a></span><span>
</span><span id="line-390"></span><span>                </span><span class="hs-special">(</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621681032821"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">]</span><span>                       </span><span class="hs-comment">--   instructions after register allocation</span><span>
</span><span id="line-391"></span><span>                </span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.CmmToAsm.Instr.html#NatBasicBlock"><span class="hs-identifier hs-type">NatBasicBlock</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032821"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span></span></span><span>        </span><span class="hs-comment">--   fresh blocks of fixup code.</span><span>
</span><span id="line-392"></span><span>
</span><span id="line-393"></span><span>
</span><span id="line-394"></span><span id="linearRA"><span class="annot"><span class="annottext">linearRA :: forall freeRegs instr.
OutputableRegConstraint freeRegs instr =&gt;
BlockMap RegSet
-&gt; [instr]
-&gt; [NatBasicBlock instr]
-&gt; BlockId
-&gt; [LiveInstr instr]
-&gt; RegM freeRegs ([instr], [NatBasicBlock instr])
</span><a href="GHC.CmmToAsm.Reg.Linear.html#linearRA"><span class="hs-identifier hs-var hs-var">linearRA</span></a></span></span><span> </span><span class="annot"><span class="annottext">BlockMap RegSet
</span><span class="hs-identifier">_</span></span><span>          </span><span id="local-6989586621681032443"><span class="annot"><span class="annottext">[instr]
</span><a href="#local-6989586621681032443"><span class="hs-identifier hs-var">accInstr</span></a></span></span><span> </span><span id="local-6989586621681032442"><span class="annot"><span class="annottext">[NatBasicBlock instr]
</span><a href="#local-6989586621681032442"><span class="hs-identifier hs-var">accFixup</span></a></span></span><span> </span><span class="annot"><span class="annottext">BlockId
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-395"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">([instr], [NatBasicBlock instr])
-&gt; RegM freeRegs ([instr], [NatBasicBlock instr])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span>
</span><span id="line-396"></span><span>                </span><span class="hs-special">(</span><span> </span><span class="annot"><span class="annottext">[instr] -&gt; [instr]
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="annot"><span class="annottext">[instr]
</span><a href="#local-6989586621681032443"><span class="hs-identifier hs-var">accInstr</span></a></span><span>              </span><span class="hs-comment">-- instrs need to be returned in the correct order.</span><span>
</span><span id="line-397"></span><span>                </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[NatBasicBlock instr]
</span><a href="#local-6989586621681032442"><span class="hs-identifier hs-var">accFixup</span></a></span><span class="hs-special">)</span><span>                     </span><span class="hs-comment">-- it doesn't matter what order the fixup blocks are returned in.</span><span>
</span><span id="line-398"></span><span>
</span><span id="line-399"></span><span>
</span><span id="line-400"></span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.html#linearRA"><span class="hs-identifier hs-var">linearRA</span></a></span><span> </span><span id="local-6989586621681032441"><span class="annot"><span class="annottext">BlockMap RegSet
</span><a href="#local-6989586621681032441"><span class="hs-identifier hs-var">block_live</span></a></span></span><span> </span><span id="local-6989586621681032440"><span class="annot"><span class="annottext">[instr]
</span><a href="#local-6989586621681032440"><span class="hs-identifier hs-var">accInstr</span></a></span></span><span> </span><span id="local-6989586621681032439"><span class="annot"><span class="annottext">[NatBasicBlock instr]
</span><a href="#local-6989586621681032439"><span class="hs-identifier hs-var">accFixups</span></a></span></span><span> </span><span id="local-6989586621681032438"><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681032438"><span class="hs-identifier hs-var">id</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681032437"><span class="annot"><span class="annottext">LiveInstr instr
</span><a href="#local-6989586621681032437"><span class="hs-identifier hs-var">instr</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621681032436"><span class="annot"><span class="annottext">[LiveInstr instr]
</span><a href="#local-6989586621681032436"><span class="hs-identifier hs-var">instrs</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-401"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-402"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621681032435"><span class="annot"><span class="annottext">[instr]
</span><a href="#local-6989586621681032435"><span class="hs-identifier hs-var">accInstr'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681032434"><span class="annot"><span class="annottext">[NatBasicBlock instr]
</span><a href="#local-6989586621681032434"><span class="hs-identifier hs-var">new_fixups</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">BlockMap RegSet
-&gt; [instr]
-&gt; BlockId
-&gt; LiveInstr instr
-&gt; RegM freeRegs ([instr], [NatBasicBlock instr])
forall freeRegs instr.
OutputableRegConstraint freeRegs instr =&gt;
BlockMap RegSet
-&gt; [instr]
-&gt; BlockId
-&gt; LiveInstr instr
-&gt; RegM freeRegs ([instr], [NatBasicBlock instr])
</span><a href="GHC.CmmToAsm.Reg.Linear.html#raInsn"><span class="hs-identifier hs-var">raInsn</span></a></span><span> </span><span class="annot"><span class="annottext">BlockMap RegSet
</span><a href="#local-6989586621681032441"><span class="hs-identifier hs-var">block_live</span></a></span><span> </span><span class="annot"><span class="annottext">[instr]
</span><a href="#local-6989586621681032440"><span class="hs-identifier hs-var">accInstr</span></a></span><span> </span><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681032438"><span class="hs-identifier hs-var">id</span></a></span><span> </span><span class="annot"><span class="annottext">LiveInstr instr
</span><a href="#local-6989586621681032437"><span class="hs-identifier hs-var">instr</span></a></span><span>
</span><span id="line-403"></span><span>
</span><span id="line-404"></span><span>        </span><span class="annot"><span class="annottext">BlockMap RegSet
-&gt; [instr]
-&gt; [NatBasicBlock instr]
-&gt; BlockId
-&gt; [LiveInstr instr]
-&gt; RegM freeRegs ([instr], [NatBasicBlock instr])
forall freeRegs instr.
OutputableRegConstraint freeRegs instr =&gt;
BlockMap RegSet
-&gt; [instr]
-&gt; [NatBasicBlock instr]
-&gt; BlockId
-&gt; [LiveInstr instr]
-&gt; RegM freeRegs ([instr], [NatBasicBlock instr])
</span><a href="GHC.CmmToAsm.Reg.Linear.html#linearRA"><span class="hs-identifier hs-var">linearRA</span></a></span><span> </span><span class="annot"><span class="annottext">BlockMap RegSet
</span><a href="#local-6989586621681032441"><span class="hs-identifier hs-var">block_live</span></a></span><span> </span><span class="annot"><span class="annottext">[instr]
</span><a href="#local-6989586621681032435"><span class="hs-identifier hs-var">accInstr'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[NatBasicBlock instr]
</span><a href="#local-6989586621681032434"><span class="hs-identifier hs-var">new_fixups</span></a></span><span> </span><span class="annot"><span class="annottext">[NatBasicBlock instr]
-&gt; [NatBasicBlock instr] -&gt; [NatBasicBlock instr]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[NatBasicBlock instr]
</span><a href="#local-6989586621681032439"><span class="hs-identifier hs-var">accFixups</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681032438"><span class="hs-identifier hs-var">id</span></a></span><span> </span><span class="annot"><span class="annottext">[LiveInstr instr]
</span><a href="#local-6989586621681032436"><span class="hs-identifier hs-var">instrs</span></a></span><span>
</span><span id="line-405"></span><span>
</span><span id="line-406"></span><span>
</span><span id="line-407"></span><span class="hs-comment">-- | Do allocation for a single instruction.</span><span>
</span><span id="line-408"></span><span id="local-6989586621681032800"><span id="local-6989586621681032801"><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.html#raInsn"><span class="hs-identifier hs-type">raInsn</span></a></span><span>
</span><span id="line-409"></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.html#OutputableRegConstraint"><span class="hs-identifier hs-type">OutputableRegConstraint</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032801"><span class="hs-identifier hs-type">freeRegs</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032800"><span class="hs-identifier hs-type">instr</span></a></span><span>
</span><span id="line-410"></span><span>        </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#BlockMap"><span class="hs-identifier hs-type">BlockMap</span></a></span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#RegSet"><span class="hs-identifier hs-type">RegSet</span></a></span><span>                      </span><span class="hs-comment">-- ^ map of what vregs are love on entry to each block.</span><span>
</span><span id="line-411"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621681032800"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">]</span><span>                              </span><span class="hs-comment">-- ^ accumulator for instructions already processed.</span><span>
</span><span id="line-412"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Cmm.BlockId.html#BlockId"><span class="hs-identifier hs-type">BlockId</span></a></span><span>                              </span><span class="hs-comment">-- ^ the id of the current block, for debugging</span><span>
</span><span id="line-413"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#LiveInstr"><span class="hs-identifier hs-type">LiveInstr</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032800"><span class="hs-identifier hs-type">instr</span></a></span><span>                      </span><span class="hs-comment">-- ^ the instr to have its regs allocated, with liveness info.</span><span>
</span><span id="line-414"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.State.html#RegM"><span class="hs-identifier hs-type">RegM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032801"><span class="hs-identifier hs-type">freeRegs</span></a></span><span>
</span><span id="line-415"></span><span>                </span><span class="hs-special">(</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621681032800"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">]</span><span>                       </span><span class="hs-comment">-- new instructions</span><span>
</span><span id="line-416"></span><span>                </span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.CmmToAsm.Instr.html#NatBasicBlock"><span class="hs-identifier hs-type">NatBasicBlock</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032800"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span></span></span><span>        </span><span class="hs-comment">-- extra fixup blocks</span><span>
</span><span id="line-417"></span><span>
</span><span id="line-418"></span><span id="raInsn"><span class="annot"><span class="annottext">raInsn :: forall freeRegs instr.
OutputableRegConstraint freeRegs instr =&gt;
BlockMap RegSet
-&gt; [instr]
-&gt; BlockId
-&gt; LiveInstr instr
-&gt; RegM freeRegs ([instr], [NatBasicBlock instr])
</span><a href="GHC.CmmToAsm.Reg.Linear.html#raInsn"><span class="hs-identifier hs-var hs-var">raInsn</span></a></span></span><span> </span><span class="annot"><span class="annottext">BlockMap RegSet
</span><span class="hs-identifier">_</span></span><span>     </span><span id="local-6989586621681032408"><span class="annot"><span class="annottext">[instr]
</span><a href="#local-6989586621681032408"><span class="hs-identifier hs-var">new_instrs</span></a></span></span><span> </span><span class="annot"><span class="annottext">BlockId
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#LiveInstr"><span class="hs-identifier hs-type">LiveInstr</span></a></span><span> </span><span id="local-6989586621681032406"><span class="annot"><span class="annottext">InstrSR instr
</span><a href="#local-6989586621681032406"><span class="hs-identifier hs-var">ii</span></a></span></span><span> </span><span class="annot"><span class="annottext">Maybe Liveness
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-419"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681032405"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681032405"><span class="hs-identifier hs-var">n</span></a></span></span><span>        </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">InstrSR instr -&gt; Maybe Int
forall instr. Instruction instr =&gt; instr -&gt; Maybe Int
</span><a href="GHC.CmmToAsm.Instr.html#takeDeltaInstr"><span class="hs-identifier hs-var">takeDeltaInstr</span></a></span><span> </span><span class="annot"><span class="annottext">InstrSR instr
</span><a href="#local-6989586621681032406"><span class="hs-identifier hs-var">ii</span></a></span><span>
</span><span id="line-420"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>    </span><span class="annot"><span class="annottext">Int -&gt; RegM freeRegs ()
forall freeRegs. Int -&gt; RegM freeRegs ()
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#setDeltaR"><span class="hs-identifier hs-var">setDeltaR</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681032405"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-421"></span><span>                </span><span class="annot"><span class="annottext">([instr], [NatBasicBlock instr])
-&gt; RegM freeRegs ([instr], [NatBasicBlock instr])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[instr]
</span><a href="#local-6989586621681032408"><span class="hs-identifier hs-var">new_instrs</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-422"></span><span>
</span><span id="line-423"></span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.html#raInsn"><span class="hs-identifier hs-var">raInsn</span></a></span><span> </span><span class="annot"><span class="annottext">BlockMap RegSet
</span><span class="hs-identifier">_</span></span><span>     </span><span id="local-6989586621681032402"><span class="annot"><span class="annottext">[instr]
</span><a href="#local-6989586621681032402"><span class="hs-identifier hs-var">new_instrs</span></a></span></span><span> </span><span class="annot"><span class="annottext">BlockId
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#LiveInstr"><span class="hs-identifier hs-type">LiveInstr</span></a></span><span> </span><span id="local-6989586621681032401"><span class="annot"><span class="annottext">ii :: InstrSR instr
</span><a href="#local-6989586621681032401"><span class="hs-identifier hs-var">ii</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#Instr"><span class="hs-identifier hs-type">Instr</span></a></span><span> </span><span id="local-6989586621681032399"><span class="annot"><span class="annottext">instr
</span><a href="#local-6989586621681032399"><span class="hs-identifier hs-var">i</span></a></span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Maybe Liveness
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-424"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">InstrSR instr -&gt; Bool
forall instr. Instruction instr =&gt; instr -&gt; Bool
</span><a href="GHC.CmmToAsm.Instr.html#isMetaInstr"><span class="hs-identifier hs-var">isMetaInstr</span></a></span><span> </span><span class="annot"><span class="annottext">InstrSR instr
</span><a href="#local-6989586621681032401"><span class="hs-identifier hs-var">ii</span></a></span><span>
</span><span id="line-425"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">([instr], [NatBasicBlock instr])
-&gt; RegM freeRegs ([instr], [NatBasicBlock instr])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">instr
</span><a href="#local-6989586621681032399"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">instr -&gt; [instr] -&gt; [instr]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[instr]
</span><a href="#local-6989586621681032402"><span class="hs-identifier hs-var">new_instrs</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-426"></span><span>
</span><span id="line-427"></span><span>
</span><span id="line-428"></span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.html#raInsn"><span class="hs-identifier hs-var">raInsn</span></a></span><span> </span><span id="local-6989586621681032397"><span class="annot"><span class="annottext">BlockMap RegSet
</span><a href="#local-6989586621681032397"><span class="hs-identifier hs-var">block_live</span></a></span></span><span> </span><span id="local-6989586621681032396"><span class="annot"><span class="annottext">[instr]
</span><a href="#local-6989586621681032396"><span class="hs-identifier hs-var">new_instrs</span></a></span></span><span> </span><span id="local-6989586621681032395"><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681032395"><span class="hs-identifier hs-var">id</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#LiveInstr"><span class="hs-identifier hs-type">LiveInstr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#Instr"><span class="hs-identifier hs-type">Instr</span></a></span><span> </span><span id="local-6989586621681032394"><span class="annot"><span class="annottext">instr
</span><a href="#local-6989586621681032394"><span class="hs-identifier hs-var">instr</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681032393"><span class="annot"><span class="annottext">Liveness
</span><a href="#local-6989586621681032393"><span class="hs-identifier hs-var">live</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-429"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-430"></span><span>    </span><span id="local-6989586621681032392"><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681032392"><span class="hs-identifier hs-var">assig</span></a></span></span><span>    </span><span class="hs-glyph">&lt;-</span><span> </span><span id="local-6989586621681032391"><span class="annot"><span class="annottext">forall freeRegs. RegM freeRegs (RegMap Loc)
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#getAssigR"><span class="hs-identifier hs-var">getAssigR</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.State.html#RegM"><span class="hs-identifier hs-type">RegM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032391"><span class="hs-identifier hs-type">freeRegs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Unique.FM.html#UniqFM"><span class="hs-identifier hs-type">UniqFM</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#Reg"><span class="hs-identifier hs-type">Reg</span></a></span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#Loc"><span class="hs-identifier hs-type">Loc</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-431"></span><span>
</span><span id="line-432"></span><span>    </span><span class="hs-comment">-- If we have a reg-&gt;reg move between virtual registers, where the</span><span>
</span><span id="line-433"></span><span>    </span><span class="hs-comment">-- src register is not live after this instruction, and the dst</span><span>
</span><span id="line-434"></span><span>    </span><span class="hs-comment">-- register does not already have an assignment,</span><span>
</span><span id="line-435"></span><span>    </span><span class="hs-comment">-- and the source register is assigned to a register, not to a spill slot,</span><span>
</span><span id="line-436"></span><span>    </span><span class="hs-comment">-- then we can eliminate the instruction.</span><span>
</span><span id="line-437"></span><span>    </span><span class="hs-comment">-- (we can't eliminate it if the source register is on the stack, because</span><span>
</span><span id="line-438"></span><span>    </span><span class="hs-comment">--  we do not want to use one spill slot for different virtual registers)</span><span>
</span><span id="line-439"></span><span>    </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">instr -&gt; Maybe (Reg, Reg)
forall instr. Instruction instr =&gt; instr -&gt; Maybe (Reg, Reg)
</span><a href="GHC.CmmToAsm.Instr.html#takeRegRegMoveInstr"><span class="hs-identifier hs-var">takeRegRegMoveInstr</span></a></span><span> </span><span class="annot"><span class="annottext">instr
</span><a href="#local-6989586621681032394"><span class="hs-identifier hs-var">instr</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-440"></span><span>        </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681032388"><span class="annot"><span class="annottext">Reg
</span><a href="#local-6989586621681032388"><span class="hs-identifier hs-var">src</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621681032387"><span class="annot"><span class="annottext">Reg
</span><a href="#local-6989586621681032387"><span class="hs-identifier hs-var">dst</span></a></span></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Reg
</span><a href="#local-6989586621681032388"><span class="hs-identifier hs-var">src</span></a></span><span> </span><span class="annot"><span class="annottext">Reg -&gt; RegSet -&gt; Bool
forall a. Uniquable a =&gt; a -&gt; UniqSet a -&gt; Bool
</span><a href="GHC.Types.Unique.Set.html#elementOfUniqSet"><span class="hs-operator hs-var">`elementOfUniqSet`</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Liveness -&gt; RegSet
</span><a href="GHC.CmmToAsm.Reg.Liveness.html#liveDieRead"><span class="hs-identifier hs-var hs-var">liveDieRead</span></a></span><span> </span><span class="annot"><span class="annottext">Liveness
</span><a href="#local-6989586621681032393"><span class="hs-identifier hs-var">live</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-441"></span><span>                          </span><span class="annot"><span class="annottext">Reg -&gt; Bool
</span><a href="GHC.Platform.Reg.html#isVirtualReg"><span class="hs-identifier hs-var">isVirtualReg</span></a></span><span> </span><span class="annot"><span class="annottext">Reg
</span><a href="#local-6989586621681032387"><span class="hs-identifier hs-var">dst</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-442"></span><span>                          </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Reg
</span><a href="#local-6989586621681032387"><span class="hs-identifier hs-var">dst</span></a></span><span> </span><span class="annot"><span class="annottext">Reg -&gt; RegMap Loc -&gt; Bool
forall key elt. Uniquable key =&gt; key -&gt; UniqFM key elt -&gt; Bool
</span><a href="GHC.Types.Unique.FM.html#elemUFM"><span class="hs-operator hs-var">`elemUFM`</span></a></span><span> </span><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681032392"><span class="hs-identifier hs-var">assig</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-443"></span><span>                          </span><span class="annot"><span class="annottext">Reg -&gt; Bool
</span><a href="GHC.Platform.Reg.html#isRealReg"><span class="hs-identifier hs-var">isRealReg</span></a></span><span> </span><span class="annot"><span class="annottext">Reg
</span><a href="#local-6989586621681032388"><span class="hs-identifier hs-var">src</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">Reg -&gt; RegMap Loc -&gt; Bool
</span><a href="GHC.CmmToAsm.Reg.Linear.html#isInReg"><span class="hs-identifier hs-var">isInReg</span></a></span><span> </span><span class="annot"><span class="annottext">Reg
</span><a href="#local-6989586621681032388"><span class="hs-identifier hs-var">src</span></a></span><span> </span><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681032392"><span class="hs-identifier hs-var">assig</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-444"></span><span>           </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Reg
</span><a href="#local-6989586621681032388"><span class="hs-identifier hs-var">src</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-445"></span><span>              </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Platform.Reg.html#RegReal"><span class="hs-identifier hs-type">RegReal</span></a></span><span> </span><span id="local-6989586621681032380"><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032380"><span class="hs-identifier hs-var">rr</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">RegMap Loc -&gt; RegM freeRegs ()
forall freeRegs. RegMap Loc -&gt; RegM freeRegs ()
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#setAssigR"><span class="hs-identifier hs-var">setAssigR</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RegMap Loc -&gt; Reg -&gt; Loc -&gt; RegMap Loc
forall key elt.
Uniquable key =&gt;
UniqFM key elt -&gt; key -&gt; elt -&gt; UniqFM key elt
</span><a href="GHC.Types.Unique.FM.html#addToUFM"><span class="hs-identifier hs-var">addToUFM</span></a></span><span> </span><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681032392"><span class="hs-identifier hs-var">assig</span></a></span><span> </span><span class="annot"><span class="annottext">Reg
</span><a href="#local-6989586621681032387"><span class="hs-identifier hs-var">dst</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RealReg -&gt; Loc
</span><a href="GHC.CmmToAsm.Reg.Linear.Base.html#InReg"><span class="hs-identifier hs-var">InReg</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032380"><span class="hs-identifier hs-var">rr</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-446"></span><span>                </span><span class="hs-comment">-- if src is a fixed reg, then we just map dest to this</span><span>
</span><span id="line-447"></span><span>                </span><span class="hs-comment">-- reg in the assignment.  src must be an allocatable reg,</span><span>
</span><span id="line-448"></span><span>                </span><span class="hs-comment">-- otherwise it wouldn't be in r_dying.</span><span>
</span><span id="line-449"></span><span>              </span><span id="local-6989586621681032377"><span class="annot"><span class="annottext">Reg
</span><a href="#local-6989586621681032377"><span class="hs-identifier hs-var">_virt</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">RegMap Loc -&gt; Reg -&gt; Maybe Loc
forall key elt. Uniquable key =&gt; UniqFM key elt -&gt; key -&gt; Maybe elt
</span><a href="GHC.Types.Unique.FM.html#lookupUFM"><span class="hs-identifier hs-var">lookupUFM</span></a></span><span> </span><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681032392"><span class="hs-identifier hs-var">assig</span></a></span><span> </span><span class="annot"><span class="annottext">Reg
</span><a href="#local-6989586621681032388"><span class="hs-identifier hs-var">src</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-450"></span><span>                         </span><span class="annot"><span class="annottext">Maybe Loc
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; RegM freeRegs ()
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;raInsn&quot;</span></span><span>
</span><span id="line-451"></span><span>                         </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681032375"><span class="annot"><span class="annottext">Loc
</span><a href="#local-6989586621681032375"><span class="hs-identifier hs-var">loc</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-452"></span><span>                           </span><span class="annot"><span class="annottext">RegMap Loc -&gt; RegM freeRegs ()
forall freeRegs. RegMap Loc -&gt; RegM freeRegs ()
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#setAssigR"><span class="hs-identifier hs-var">setAssigR</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RegMap Loc -&gt; Reg -&gt; Loc -&gt; RegMap Loc
forall key elt.
Uniquable key =&gt;
UniqFM key elt -&gt; key -&gt; elt -&gt; UniqFM key elt
</span><a href="GHC.Types.Unique.FM.html#addToUFM"><span class="hs-identifier hs-var">addToUFM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RegMap Loc -&gt; Reg -&gt; RegMap Loc
forall key elt.
Uniquable key =&gt;
UniqFM key elt -&gt; key -&gt; UniqFM key elt
</span><a href="GHC.Types.Unique.FM.html#delFromUFM"><span class="hs-identifier hs-var">delFromUFM</span></a></span><span> </span><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681032392"><span class="hs-identifier hs-var">assig</span></a></span><span> </span><span class="annot"><span class="annottext">Reg
</span><a href="#local-6989586621681032388"><span class="hs-identifier hs-var">src</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Reg
</span><a href="#local-6989586621681032387"><span class="hs-identifier hs-var">dst</span></a></span><span> </span><span class="annot"><span class="annottext">Loc
</span><a href="#local-6989586621681032375"><span class="hs-identifier hs-var">loc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-453"></span><span>
</span><span id="line-454"></span><span>           </span><span class="hs-comment">-- we have eliminated this instruction</span><span>
</span><span id="line-455"></span><span>          </span><span class="hs-comment">{-
          freeregs &lt;- getFreeRegsR
          assig &lt;- getAssigR
          pprTrace &quot;raInsn&quot; (text &quot;ELIMINATED: &quot; &lt;&gt; docToSDoc (pprInstr instr)
                        $$ ppr r_dying &lt;+&gt; ppr w_dying $$ text (show freeregs) $$ ppr assig) $ do
          -}</span><span>
</span><span id="line-461"></span><span>           </span><span class="annot"><span class="annottext">([instr], [NatBasicBlock instr])
-&gt; RegM freeRegs ([instr], [NatBasicBlock instr])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[instr]
</span><a href="#local-6989586621681032396"><span class="hs-identifier hs-var">new_instrs</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-462"></span><span>
</span><span id="line-463"></span><span>        </span><span class="annot"><span class="annottext">Maybe (Reg, Reg)
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">BlockMap RegSet
-&gt; [instr]
-&gt; BlockId
-&gt; instr
-&gt; [Reg]
-&gt; [Reg]
-&gt; RegM freeRegs ([instr], [NatBasicBlock instr])
forall freeRegs instr.
OutputableRegConstraint freeRegs instr =&gt;
BlockMap RegSet
-&gt; [instr]
-&gt; BlockId
-&gt; instr
-&gt; [Reg]
-&gt; [Reg]
-&gt; RegM freeRegs ([instr], [NatBasicBlock instr])
</span><a href="GHC.CmmToAsm.Reg.Linear.html#genRaInsn"><span class="hs-identifier hs-var">genRaInsn</span></a></span><span> </span><span class="annot"><span class="annottext">BlockMap RegSet
</span><a href="#local-6989586621681032397"><span class="hs-identifier hs-var">block_live</span></a></span><span> </span><span class="annot"><span class="annottext">[instr]
</span><a href="#local-6989586621681032396"><span class="hs-identifier hs-var">new_instrs</span></a></span><span> </span><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681032395"><span class="hs-identifier hs-var">id</span></a></span><span> </span><span class="annot"><span class="annottext">instr
</span><a href="#local-6989586621681032394"><span class="hs-identifier hs-var">instr</span></a></span><span>
</span><span id="line-464"></span><span>                        </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RegSet -&gt; [Reg]
forall elt. UniqSet elt -&gt; [elt]
</span><a href="GHC.Types.Unique.Set.html#nonDetEltsUniqSet"><span class="hs-identifier hs-var">nonDetEltsUniqSet</span></a></span><span> </span><span class="annot"><span class="annottext">(RegSet -&gt; [Reg]) -&gt; RegSet -&gt; [Reg]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Liveness -&gt; RegSet
</span><a href="GHC.CmmToAsm.Reg.Liveness.html#liveDieRead"><span class="hs-identifier hs-var hs-var">liveDieRead</span></a></span><span> </span><span class="annot"><span class="annottext">Liveness
</span><a href="#local-6989586621681032393"><span class="hs-identifier hs-var">live</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-465"></span><span>                        </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RegSet -&gt; [Reg]
forall elt. UniqSet elt -&gt; [elt]
</span><a href="GHC.Types.Unique.Set.html#nonDetEltsUniqSet"><span class="hs-identifier hs-var">nonDetEltsUniqSet</span></a></span><span> </span><span class="annot"><span class="annottext">(RegSet -&gt; [Reg]) -&gt; RegSet -&gt; [Reg]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Liveness -&gt; RegSet
</span><a href="GHC.CmmToAsm.Reg.Liveness.html#liveDieWrite"><span class="hs-identifier hs-var hs-var">liveDieWrite</span></a></span><span> </span><span class="annot"><span class="annottext">Liveness
</span><a href="#local-6989586621681032393"><span class="hs-identifier hs-var">live</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-466"></span><span>                        </span><span class="hs-comment">-- See Note [Unique Determinism and code generation]</span><span>
</span><span id="line-467"></span><span>
</span><span id="line-468"></span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.html#raInsn"><span class="hs-identifier hs-var">raInsn</span></a></span><span> </span><span class="annot"><span class="annottext">BlockMap RegSet
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">[instr]
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">BlockId
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681032371"><span class="annot"><span class="annottext">LiveInstr instr
</span><a href="#local-6989586621681032371"><span class="hs-identifier hs-var">instr</span></a></span></span><span>
</span><span id="line-469"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; RegM freeRegs ([instr], [NatBasicBlock instr])
forall a. HasCallStack =&gt; String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;raInsn&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;no match for:&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">LiveInstr instr -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">LiveInstr instr
</span><a href="#local-6989586621681032371"><span class="hs-identifier hs-var">instr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-470"></span><span>
</span><span id="line-471"></span><span class="hs-comment">-- ToDo: what can we do about</span><span>
</span><span id="line-472"></span><span class="hs-comment">--</span><span>
</span><span id="line-473"></span><span class="hs-comment">--     R1 = x</span><span>
</span><span id="line-474"></span><span class="hs-comment">--     jump I64[x] // [R1]</span><span>
</span><span id="line-475"></span><span class="hs-comment">--</span><span>
</span><span id="line-476"></span><span class="hs-comment">-- where x is mapped to the same reg as R1.  We want to coalesce x and</span><span>
</span><span id="line-477"></span><span class="hs-comment">-- R1, but the register allocator doesn't know whether x will be</span><span>
</span><span id="line-478"></span><span class="hs-comment">-- assigned to again later, in which case x and R1 should be in</span><span>
</span><span id="line-479"></span><span class="hs-comment">-- different registers.  Right now we assume the worst, and the</span><span>
</span><span id="line-480"></span><span class="hs-comment">-- assignment to R1 will clobber x, so we'll spill x into another reg,</span><span>
</span><span id="line-481"></span><span class="hs-comment">-- generating another reg-&gt;reg move.</span><span>
</span><span id="line-482"></span><span>
</span><span id="line-483"></span><span>
</span><span id="line-484"></span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.html#isInReg"><span class="hs-identifier hs-type">isInReg</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#Reg"><span class="hs-identifier hs-type">Reg</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#RegMap"><span class="hs-identifier hs-type">RegMap</span></a></span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#Loc"><span class="hs-identifier hs-type">Loc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-485"></span><span id="isInReg"><span class="annot"><span class="annottext">isInReg :: Reg -&gt; RegMap Loc -&gt; Bool
</span><a href="GHC.CmmToAsm.Reg.Linear.html#isInReg"><span class="hs-identifier hs-var hs-var">isInReg</span></a></span></span><span> </span><span id="local-6989586621681032366"><span class="annot"><span class="annottext">Reg
</span><a href="#local-6989586621681032366"><span class="hs-identifier hs-var">src</span></a></span></span><span> </span><span id="local-6989586621681032365"><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681032365"><span class="hs-identifier hs-var">assig</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#InReg"><span class="hs-identifier hs-type">InReg</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">RegMap Loc -&gt; Reg -&gt; Maybe Loc
forall key elt. Uniquable key =&gt; UniqFM key elt -&gt; key -&gt; Maybe elt
</span><a href="GHC.Types.Unique.FM.html#lookupUFM"><span class="hs-identifier hs-var">lookupUFM</span></a></span><span> </span><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681032365"><span class="hs-identifier hs-var">assig</span></a></span><span> </span><span class="annot"><span class="annottext">Reg
</span><a href="#local-6989586621681032366"><span class="hs-identifier hs-var">src</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-486"></span><span>                  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-487"></span><span>
</span><span id="line-488"></span><span>
</span><span id="line-489"></span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.html#genRaInsn"><span class="hs-identifier hs-type">genRaInsn</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-keyword">forall</span><span> </span><span id="local-6989586621681032779"><span class="annot"><a href="#local-6989586621681032779"><span class="hs-identifier hs-type">freeRegs</span></a></span></span><span> </span><span id="local-6989586621681032778"><span class="annot"><a href="#local-6989586621681032778"><span class="hs-identifier hs-type">instr</span></a></span></span><span class="hs-operator">.</span><span>
</span><span id="line-490"></span><span>             </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.html#OutputableRegConstraint"><span class="hs-identifier hs-type">OutputableRegConstraint</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032779"><span class="hs-identifier hs-type">freeRegs</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032778"><span class="hs-identifier hs-type">instr</span></a></span><span>
</span><span id="line-491"></span><span>          </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#BlockMap"><span class="hs-identifier hs-type">BlockMap</span></a></span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#RegSet"><span class="hs-identifier hs-type">RegSet</span></a></span><span>
</span><span id="line-492"></span><span>          </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621681032778"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-493"></span><span>          </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Cmm.BlockId.html#BlockId"><span class="hs-identifier hs-type">BlockId</span></a></span><span>
</span><span id="line-494"></span><span>          </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621681032778"><span class="hs-identifier hs-type">instr</span></a></span><span>
</span><span id="line-495"></span><span>          </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Platform.Reg.html#Reg"><span class="hs-identifier hs-type">Reg</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-496"></span><span>          </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Platform.Reg.html#Reg"><span class="hs-identifier hs-type">Reg</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-497"></span><span>          </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.State.html#RegM"><span class="hs-identifier hs-type">RegM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032779"><span class="hs-identifier hs-type">freeRegs</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621681032778"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.CmmToAsm.Instr.html#NatBasicBlock"><span class="hs-identifier hs-type">NatBasicBlock</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032778"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-498"></span><span>
</span><span id="line-499"></span><span id="genRaInsn"><span class="annot"><span class="annottext">genRaInsn :: forall freeRegs instr.
OutputableRegConstraint freeRegs instr =&gt;
BlockMap RegSet
-&gt; [instr]
-&gt; BlockId
-&gt; instr
-&gt; [Reg]
-&gt; [Reg]
-&gt; RegM freeRegs ([instr], [NatBasicBlock instr])
</span><a href="GHC.CmmToAsm.Reg.Linear.html#genRaInsn"><span class="hs-identifier hs-var hs-var">genRaInsn</span></a></span></span><span> </span><span id="local-6989586621681032332"><span class="annot"><span class="annottext">BlockMap RegSet
</span><a href="#local-6989586621681032332"><span class="hs-identifier hs-var">block_live</span></a></span></span><span> </span><span id="local-6989586621681032331"><span class="annot"><span class="annottext">[instr]
</span><a href="#local-6989586621681032331"><span class="hs-identifier hs-var">new_instrs</span></a></span></span><span> </span><span id="local-6989586621681032330"><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681032330"><span class="hs-identifier hs-var">block_id</span></a></span></span><span> </span><span id="local-6989586621681032329"><span class="annot"><span class="annottext">instr
</span><a href="#local-6989586621681032329"><span class="hs-identifier hs-var">instr</span></a></span></span><span> </span><span id="local-6989586621681032328"><span class="annot"><span class="annottext">[Reg]
</span><a href="#local-6989586621681032328"><span class="hs-identifier hs-var">r_dying</span></a></span></span><span> </span><span id="local-6989586621681032327"><span class="annot"><span class="annottext">[Reg]
</span><a href="#local-6989586621681032327"><span class="hs-identifier hs-var">w_dying</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-500"></span><span class="hs-comment">--   pprTraceM &quot;genRaInsn&quot; $ ppr (block_id, instr)</span><span>
</span><span id="line-501"></span><span>  </span><span id="local-6989586621681032326"><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681032326"><span class="hs-identifier hs-var">platform</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">RegM freeRegs Platform
forall a. RegM a Platform
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#getPlatform"><span class="hs-identifier hs-var">getPlatform</span></a></span><span>
</span><span id="line-502"></span><span>  </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Platform -&gt; instr -&gt; RegUsage
forall instr. Instruction instr =&gt; Platform -&gt; instr -&gt; RegUsage
</span><a href="GHC.CmmToAsm.Instr.html#regUsageOfInstr"><span class="hs-identifier hs-var">regUsageOfInstr</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681032326"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="annot"><span class="annottext">instr
</span><a href="#local-6989586621681032329"><span class="hs-identifier hs-var">instr</span></a></span><span> </span><span class="hs-keyword">of</span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Instr.html#RU"><span class="hs-identifier hs-type">RU</span></a></span><span> </span><span id="local-6989586621681032323"><span class="annot"><span class="annottext">[Reg]
</span><a href="#local-6989586621681032323"><span class="hs-identifier hs-var">read</span></a></span></span><span> </span><span id="local-6989586621681032322"><span class="annot"><span class="annottext">[Reg]
</span><a href="#local-6989586621681032322"><span class="hs-identifier hs-var">written</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-503"></span><span>    </span><span class="hs-keyword">do</span><span>
</span><span id="line-504"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681032321"><span class="annot"><span class="annottext">real_written :: [RealReg]
</span><a href="#local-6989586621681032321"><span class="hs-identifier hs-var hs-var">real_written</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032320"><span class="hs-identifier hs-var">rr</span></a></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Platform.Reg.html#RegReal"><span class="hs-identifier hs-type">RegReal</span></a></span><span>     </span><span id="local-6989586621681032320"><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032320"><span class="hs-identifier hs-var">rr</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[Reg]
</span><a href="#local-6989586621681032322"><span class="hs-identifier hs-var">written</span></a></span><span> </span><span class="hs-special">]</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Platform.Reg.html#RealReg"><span class="hs-identifier hs-type">RealReg</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-505"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681032319"><span class="annot"><span class="annottext">virt_written :: [VirtualReg]
</span><a href="#local-6989586621681032319"><span class="hs-identifier hs-var hs-var">virt_written</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681032318"><span class="hs-identifier hs-var">vr</span></a></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Platform.Reg.html#RegVirtual"><span class="hs-identifier hs-type">RegVirtual</span></a></span><span>  </span><span id="local-6989586621681032318"><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681032318"><span class="hs-identifier hs-var">vr</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[Reg]
</span><a href="#local-6989586621681032322"><span class="hs-identifier hs-var">written</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-506"></span><span>
</span><span id="line-507"></span><span>    </span><span class="hs-comment">-- we don't need to do anything with real registers that are</span><span>
</span><span id="line-508"></span><span>    </span><span class="hs-comment">-- only read by this instr.  (the list is typically ~2 elements,</span><span>
</span><span id="line-509"></span><span>    </span><span class="hs-comment">-- so using nub isn't a problem).</span><span>
</span><span id="line-510"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681032314"><span class="annot"><span class="annottext">virt_read :: [VirtualReg]
</span><a href="#local-6989586621681032314"><span class="hs-identifier hs-var hs-var">virt_read</span></a></span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[VirtualReg] -&gt; [VirtualReg]
forall a. Eq a =&gt; [a] -&gt; [a]
</span><a href="../../base/src/Data.OldList.html#nub"><span class="hs-identifier hs-var">nub</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681032312"><span class="hs-identifier hs-var">vr</span></a></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Platform.Reg.html#RegVirtual"><span class="hs-identifier hs-type">RegVirtual</span></a></span><span> </span><span id="local-6989586621681032312"><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681032312"><span class="hs-identifier hs-var">vr</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[Reg]
</span><a href="#local-6989586621681032323"><span class="hs-identifier hs-var">read</span></a></span><span> </span><span class="hs-special">]</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Platform.Reg.html#VirtualReg"><span class="hs-identifier hs-type">VirtualReg</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-511"></span><span>
</span><span id="line-512"></span><span>    </span><span class="hs-comment">-- debugging</span><span>
</span><span id="line-513"></span><span class="hs-comment">{-    freeregs &lt;- getFreeRegsR
    assig    &lt;- getAssigR
    pprDebugAndThen (defaultDynFlags Settings{ sTargetPlatform=platform } undefined) trace &quot;genRaInsn&quot;
        (ppr instr
                $$ text &quot;r_dying      = &quot; &lt;+&gt; ppr r_dying
                $$ text &quot;w_dying      = &quot; &lt;+&gt; ppr w_dying
                $$ text &quot;virt_read    = &quot; &lt;+&gt; ppr virt_read
                $$ text &quot;virt_written = &quot; &lt;+&gt; ppr virt_written
                $$ text &quot;freeregs     = &quot; &lt;+&gt; text (show freeregs)
                $$ text &quot;assig        = &quot; &lt;+&gt; ppr assig)
        $ do
-}</span><span>
</span><span id="line-525"></span><span>
</span><span id="line-526"></span><span>    </span><span class="hs-comment">-- (a), (b) allocate real regs for all regs read by this instruction.</span><span>
</span><span id="line-527"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621681032311"><span class="annot"><span class="annottext">[instr]
</span><a href="#local-6989586621681032311"><span class="hs-identifier hs-var">r_spills</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681032310"><span class="annot"><span class="annottext">[RealReg]
</span><a href="#local-6989586621681032310"><span class="hs-identifier hs-var">r_allocd</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span>
</span><span id="line-528"></span><span>        </span><span class="annot"><span class="annottext">Bool
-&gt; [VirtualReg]
-&gt; [instr]
-&gt; [RealReg]
-&gt; [VirtualReg]
-&gt; RegM freeRegs ([instr], [RealReg])
forall freeRegs instr.
(FR freeRegs, Outputable instr, Instruction instr) =&gt;
Bool
-&gt; [VirtualReg]
-&gt; [instr]
-&gt; [RealReg]
-&gt; [VirtualReg]
-&gt; RegM freeRegs ([instr], [RealReg])
</span><a href="GHC.CmmToAsm.Reg.Linear.html#allocateRegsAndSpill"><span class="hs-identifier hs-var">allocateRegsAndSpill</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span class="hs-comment">{-reading-}</span><span> </span><span class="annot"><span class="annottext">[VirtualReg]
</span><a href="#local-6989586621681032314"><span class="hs-identifier hs-var">virt_read</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">[VirtualReg]
</span><a href="#local-6989586621681032314"><span class="hs-identifier hs-var">virt_read</span></a></span><span>
</span><span id="line-529"></span><span>
</span><span id="line-530"></span><span>    </span><span class="hs-comment">-- (c) save any temporaries which will be clobbered by this instruction</span><span>
</span><span id="line-531"></span><span>    </span><span id="local-6989586621681032308"><span class="annot"><span class="annottext">[instr]
</span><a href="#local-6989586621681032308"><span class="hs-identifier hs-var">clobber_saves</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[RealReg] -&gt; [Reg] -&gt; RegM freeRegs [instr]
forall instr freeRegs.
(Instruction instr, FR freeRegs) =&gt;
[RealReg] -&gt; [Reg] -&gt; RegM freeRegs [instr]
</span><a href="GHC.CmmToAsm.Reg.Linear.html#saveClobberedTemps"><span class="hs-identifier hs-var">saveClobberedTemps</span></a></span><span> </span><span class="annot"><span class="annottext">[RealReg]
</span><a href="#local-6989586621681032321"><span class="hs-identifier hs-var">real_written</span></a></span><span> </span><span class="annot"><span class="annottext">[Reg]
</span><a href="#local-6989586621681032328"><span class="hs-identifier hs-var">r_dying</span></a></span><span>
</span><span id="line-532"></span><span>
</span><span id="line-533"></span><span>    </span><span class="hs-comment">-- (d) Update block map for new destinations</span><span>
</span><span id="line-534"></span><span>    </span><span class="hs-comment">-- NB. do this before removing dead regs from the assignment, because</span><span>
</span><span id="line-535"></span><span>    </span><span class="hs-comment">-- these dead regs might in fact be live in the jump targets (they're</span><span>
</span><span id="line-536"></span><span>    </span><span class="hs-comment">-- only dead in the code that follows in the current basic block).</span><span>
</span><span id="line-537"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621681032306"><span class="annot"><span class="annottext">[NatBasicBlock instr]
</span><a href="#local-6989586621681032306"><span class="hs-identifier hs-var">fixup_blocks</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681032305"><span class="annot"><span class="annottext">instr
</span><a href="#local-6989586621681032305"><span class="hs-identifier hs-var">adjusted_instr</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-538"></span><span>        </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">BlockMap RegSet
-&gt; BlockId -&gt; instr -&gt; RegM freeRegs ([NatBasicBlock instr], instr)
forall freeRegs instr.
(FR freeRegs, Instruction instr, Outputable instr) =&gt;
BlockMap RegSet
-&gt; BlockId -&gt; instr -&gt; RegM freeRegs ([NatBasicBlock instr], instr)
</span><a href="GHC.CmmToAsm.Reg.Linear.JoinToTargets.html#joinToTargets"><span class="hs-identifier hs-var">joinToTargets</span></a></span><span> </span><span class="annot"><span class="annottext">BlockMap RegSet
</span><a href="#local-6989586621681032332"><span class="hs-identifier hs-var">block_live</span></a></span><span> </span><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681032330"><span class="hs-identifier hs-var">block_id</span></a></span><span> </span><span class="annot"><span class="annottext">instr
</span><a href="#local-6989586621681032329"><span class="hs-identifier hs-var">instr</span></a></span><span>
</span><span id="line-539"></span><span>
</span><span id="line-540"></span><span class="hs-comment">--     when (not $ null fixup_blocks) $ pprTraceM &quot;genRA:FixBlocks&quot; $ ppr fixup_blocks</span><span>
</span><span id="line-541"></span><span>
</span><span id="line-542"></span><span>    </span><span class="hs-comment">-- Debugging - show places where the reg alloc inserted</span><span>
</span><span id="line-543"></span><span>    </span><span class="hs-comment">-- assignment fixup blocks.</span><span>
</span><span id="line-544"></span><span>    </span><span class="hs-comment">-- when (not $ null fixup_blocks) $</span><span>
</span><span id="line-545"></span><span>    </span><span class="hs-comment">--    pprTrace &quot;fixup_blocks&quot; (ppr fixup_blocks) (return ())</span><span>
</span><span id="line-546"></span><span>
</span><span id="line-547"></span><span>    </span><span class="hs-comment">-- (e) Delete all register assignments for temps which are read</span><span>
</span><span id="line-548"></span><span>    </span><span class="hs-comment">--     (only) and die here.  Update the free register list.</span><span>
</span><span id="line-549"></span><span>    </span><span class="annot"><span class="annottext">[Reg] -&gt; RegM freeRegs ()
forall freeRegs. FR freeRegs =&gt; [Reg] -&gt; RegM freeRegs ()
</span><a href="GHC.CmmToAsm.Reg.Linear.html#releaseRegs"><span class="hs-identifier hs-var">releaseRegs</span></a></span><span> </span><span class="annot"><span class="annottext">[Reg]
</span><a href="#local-6989586621681032328"><span class="hs-identifier hs-var">r_dying</span></a></span><span>
</span><span id="line-550"></span><span>
</span><span id="line-551"></span><span>    </span><span class="hs-comment">-- (f) Mark regs which are clobbered as unallocatable</span><span>
</span><span id="line-552"></span><span>    </span><span class="annot"><span class="annottext">[RealReg] -&gt; RegM freeRegs ()
forall freeRegs. FR freeRegs =&gt; [RealReg] -&gt; RegM freeRegs ()
</span><a href="GHC.CmmToAsm.Reg.Linear.html#clobberRegs"><span class="hs-identifier hs-var">clobberRegs</span></a></span><span> </span><span class="annot"><span class="annottext">[RealReg]
</span><a href="#local-6989586621681032321"><span class="hs-identifier hs-var">real_written</span></a></span><span>
</span><span id="line-553"></span><span>
</span><span id="line-554"></span><span>    </span><span class="hs-comment">-- (g) Allocate registers for temporaries *written* (only)</span><span>
</span><span id="line-555"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621681032301"><span class="annot"><span class="annottext">[instr]
</span><a href="#local-6989586621681032301"><span class="hs-identifier hs-var">w_spills</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681032300"><span class="annot"><span class="annottext">[RealReg]
</span><a href="#local-6989586621681032300"><span class="hs-identifier hs-var">w_allocd</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span>
</span><span id="line-556"></span><span>        </span><span class="annot"><span class="annottext">Bool
-&gt; [VirtualReg]
-&gt; [instr]
-&gt; [RealReg]
-&gt; [VirtualReg]
-&gt; RegM freeRegs ([instr], [RealReg])
forall freeRegs instr.
(FR freeRegs, Outputable instr, Instruction instr) =&gt;
Bool
-&gt; [VirtualReg]
-&gt; [instr]
-&gt; [RealReg]
-&gt; [VirtualReg]
-&gt; RegM freeRegs ([instr], [RealReg])
</span><a href="GHC.CmmToAsm.Reg.Linear.html#allocateRegsAndSpill"><span class="hs-identifier hs-var">allocateRegsAndSpill</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span class="hs-comment">{-writing-}</span><span> </span><span class="annot"><span class="annottext">[VirtualReg]
</span><a href="#local-6989586621681032319"><span class="hs-identifier hs-var">virt_written</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">[VirtualReg]
</span><a href="#local-6989586621681032319"><span class="hs-identifier hs-var">virt_written</span></a></span><span>
</span><span id="line-557"></span><span>
</span><span id="line-558"></span><span>    </span><span class="hs-comment">-- (h) Release registers for temps which are written here and not</span><span>
</span><span id="line-559"></span><span>    </span><span class="hs-comment">-- used again.</span><span>
</span><span id="line-560"></span><span>    </span><span class="annot"><span class="annottext">[Reg] -&gt; RegM freeRegs ()
forall freeRegs. FR freeRegs =&gt; [Reg] -&gt; RegM freeRegs ()
</span><a href="GHC.CmmToAsm.Reg.Linear.html#releaseRegs"><span class="hs-identifier hs-var">releaseRegs</span></a></span><span> </span><span class="annot"><span class="annottext">[Reg]
</span><a href="#local-6989586621681032327"><span class="hs-identifier hs-var">w_dying</span></a></span><span>
</span><span id="line-561"></span><span>
</span><span id="line-562"></span><span>    </span><span class="hs-keyword">let</span><span>
</span><span id="line-563"></span><span>        </span><span class="hs-comment">-- (i) Patch the instruction</span><span>
</span><span id="line-564"></span><span>        </span><span class="annot"><a href="#local-6989586621681032299"><span class="hs-identifier hs-type">patch_map</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Unique.FM.html#UniqFM"><span class="hs-identifier hs-type">UniqFM</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#Reg"><span class="hs-identifier hs-type">Reg</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#Reg"><span class="hs-identifier hs-type">Reg</span></a></span><span>
</span><span id="line-565"></span><span>        </span><span id="local-6989586621681032299"><span class="annot"><span class="annottext">patch_map :: UniqFM Reg Reg
</span><a href="#local-6989586621681032299"><span class="hs-identifier hs-var hs-var">patch_map</span></a></span></span><span>
</span><span id="line-566"></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UniqFM VirtualReg Reg -&gt; UniqFM Reg Reg
forall elt. UniqFM VirtualReg elt -&gt; UniqFM Reg elt
</span><a href="GHC.CmmToAsm.Reg.Utils.html#toRegMap"><span class="hs-identifier hs-var">toRegMap</span></a></span><span> </span><span class="annot"><span class="annottext">(UniqFM VirtualReg Reg -&gt; UniqFM Reg Reg)
-&gt; UniqFM VirtualReg Reg -&gt; UniqFM Reg Reg
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-comment">-- Cast key from VirtualReg to Reg</span><span>
</span><span id="line-567"></span><span>                             </span><span class="hs-comment">-- See Note [UniqFM and the register allocator]</span><span>
</span><span id="line-568"></span><span>                  </span><span class="annot"><span class="annottext">[(VirtualReg, Reg)] -&gt; UniqFM VirtualReg Reg
forall key elt. Uniquable key =&gt; [(key, elt)] -&gt; UniqFM key elt
</span><a href="GHC.Types.Unique.FM.html#listToUFM"><span class="hs-identifier hs-var">listToUFM</span></a></span><span>
</span><span id="line-569"></span><span>                        </span><span class="hs-special">[</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681032296"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">RealReg -&gt; Reg
</span><a href="GHC.Platform.Reg.html#RegReal"><span class="hs-identifier hs-var">RegReal</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032295"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-570"></span><span>                                </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681032296"><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681032296"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681032295"><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032295"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[VirtualReg] -&gt; [RealReg] -&gt; [(VirtualReg, RealReg)]
forall a b. [a] -&gt; [b] -&gt; [(a, b)]
</span><a href="../../base/src/GHC.List.html#zip"><span class="hs-identifier hs-var">zip</span></a></span><span> </span><span class="annot"><span class="annottext">[VirtualReg]
</span><a href="#local-6989586621681032314"><span class="hs-identifier hs-var">virt_read</span></a></span><span>    </span><span class="annot"><span class="annottext">[RealReg]
</span><a href="#local-6989586621681032310"><span class="hs-identifier hs-var">r_allocd</span></a></span><span>
</span><span id="line-571"></span><span>                                         </span><span class="annot"><span class="annottext">[(VirtualReg, RealReg)]
-&gt; [(VirtualReg, RealReg)] -&gt; [(VirtualReg, RealReg)]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[VirtualReg] -&gt; [RealReg] -&gt; [(VirtualReg, RealReg)]
forall a b. [a] -&gt; [b] -&gt; [(a, b)]
</span><a href="../../base/src/GHC.List.html#zip"><span class="hs-identifier hs-var">zip</span></a></span><span> </span><span class="annot"><span class="annottext">[VirtualReg]
</span><a href="#local-6989586621681032319"><span class="hs-identifier hs-var">virt_written</span></a></span><span> </span><span class="annot"><span class="annottext">[RealReg]
</span><a href="#local-6989586621681032300"><span class="hs-identifier hs-var">w_allocd</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-572"></span><span>
</span><span id="line-573"></span><span>        </span><span class="annot"><a href="#local-6989586621681032294"><span class="hs-identifier hs-type">patched_instr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621681032778"><span class="hs-identifier hs-type">instr</span></a></span><span>
</span><span id="line-574"></span><span>        </span><span id="local-6989586621681032294"><span class="annot"><span class="annottext">patched_instr :: instr
</span><a href="#local-6989586621681032294"><span class="hs-identifier hs-var hs-var">patched_instr</span></a></span></span><span>
</span><span id="line-575"></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">instr -&gt; (Reg -&gt; Reg) -&gt; instr
forall instr. Instruction instr =&gt; instr -&gt; (Reg -&gt; Reg) -&gt; instr
</span><a href="GHC.CmmToAsm.Instr.html#patchRegsOfInstr"><span class="hs-identifier hs-var">patchRegsOfInstr</span></a></span><span> </span><span class="annot"><span class="annottext">instr
</span><a href="#local-6989586621681032305"><span class="hs-identifier hs-var">adjusted_instr</span></a></span><span> </span><span class="annot"><span class="annottext">Reg -&gt; Reg
</span><a href="#local-6989586621681032292"><span class="hs-identifier hs-var">patchLookup</span></a></span><span>
</span><span id="line-576"></span><span>
</span><span id="line-577"></span><span>        </span><span class="annot"><a href="#local-6989586621681032292"><span class="hs-identifier hs-type">patchLookup</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#Reg"><span class="hs-identifier hs-type">Reg</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#Reg"><span class="hs-identifier hs-type">Reg</span></a></span><span>
</span><span id="line-578"></span><span>        </span><span id="local-6989586621681032292"><span class="annot"><span class="annottext">patchLookup :: Reg -&gt; Reg
</span><a href="#local-6989586621681032292"><span class="hs-identifier hs-var hs-var">patchLookup</span></a></span></span><span> </span><span id="local-6989586621681032291"><span class="annot"><span class="annottext">Reg
</span><a href="#local-6989586621681032291"><span class="hs-identifier hs-var">x</span></a></span></span><span>
</span><span id="line-579"></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">UniqFM Reg Reg -&gt; Reg -&gt; Maybe Reg
forall key elt. Uniquable key =&gt; UniqFM key elt -&gt; key -&gt; Maybe elt
</span><a href="GHC.Types.Unique.FM.html#lookupUFM"><span class="hs-identifier hs-var">lookupUFM</span></a></span><span> </span><span class="annot"><span class="annottext">UniqFM Reg Reg
</span><a href="#local-6989586621681032299"><span class="hs-identifier hs-var">patch_map</span></a></span><span> </span><span class="annot"><span class="annottext">Reg
</span><a href="#local-6989586621681032291"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-580"></span><span>                        </span><span class="annot"><span class="annottext">Maybe Reg
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Reg
</span><a href="#local-6989586621681032291"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-581"></span><span>                        </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681032290"><span class="annot"><span class="annottext">Reg
</span><a href="#local-6989586621681032290"><span class="hs-identifier hs-var">y</span></a></span></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Reg
</span><a href="#local-6989586621681032290"><span class="hs-identifier hs-var">y</span></a></span><span>
</span><span id="line-582"></span><span>
</span><span id="line-583"></span><span>
</span><span id="line-584"></span><span>    </span><span class="hs-comment">-- (j) free up stack slots for dead spilled regs</span><span>
</span><span id="line-585"></span><span>    </span><span class="hs-comment">-- TODO (can't be bothered right now)</span><span>
</span><span id="line-586"></span><span>
</span><span id="line-587"></span><span>    </span><span class="hs-comment">-- erase reg-&gt;reg moves where the source and destination are the same.</span><span>
</span><span id="line-588"></span><span>    </span><span class="hs-comment">--  If the src temp didn't die in this instr but happened to be allocated</span><span>
</span><span id="line-589"></span><span>    </span><span class="hs-comment">--  to the same real reg as the destination, then we can erase the move anyway.</span><span>
</span><span id="line-590"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681032286"><span class="annot"><span class="annottext">squashed_instr :: [instr]
</span><a href="#local-6989586621681032286"><span class="hs-identifier hs-var hs-var">squashed_instr</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">instr -&gt; Maybe (Reg, Reg)
forall instr. Instruction instr =&gt; instr -&gt; Maybe (Reg, Reg)
</span><a href="GHC.CmmToAsm.Instr.html#takeRegRegMoveInstr"><span class="hs-identifier hs-var">takeRegRegMoveInstr</span></a></span><span> </span><span class="annot"><span class="annottext">instr
</span><a href="#local-6989586621681032294"><span class="hs-identifier hs-var">patched_instr</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-591"></span><span>                                </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681032285"><span class="annot"><span class="annottext">Reg
</span><a href="#local-6989586621681032285"><span class="hs-identifier hs-var">src</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681032284"><span class="annot"><span class="annottext">Reg
</span><a href="#local-6989586621681032284"><span class="hs-identifier hs-var">dst</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-592"></span><span>                                 </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Reg
</span><a href="#local-6989586621681032285"><span class="hs-identifier hs-var">src</span></a></span><span> </span><span class="annot"><span class="annottext">Reg -&gt; Reg -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Reg
</span><a href="#local-6989586621681032284"><span class="hs-identifier hs-var">dst</span></a></span><span>   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-593"></span><span>                                </span><span class="annot"><span class="annottext">Maybe (Reg, Reg)
</span><span class="hs-identifier">_</span></span><span>               </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">instr
</span><a href="#local-6989586621681032294"><span class="hs-identifier hs-var">patched_instr</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-594"></span><span>
</span><span id="line-595"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681032283"><span class="annot"><span class="annottext">code :: [instr]
</span><a href="#local-6989586621681032283"><span class="hs-identifier hs-var hs-var">code</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[instr]
</span><a href="#local-6989586621681032286"><span class="hs-identifier hs-var">squashed_instr</span></a></span><span> </span><span class="annot"><span class="annottext">[instr] -&gt; [instr] -&gt; [instr]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[instr]
</span><a href="#local-6989586621681032301"><span class="hs-identifier hs-var">w_spills</span></a></span><span> </span><span class="annot"><span class="annottext">[instr] -&gt; [instr] -&gt; [instr]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[instr] -&gt; [instr]
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="annot"><span class="annottext">[instr]
</span><a href="#local-6989586621681032311"><span class="hs-identifier hs-var">r_spills</span></a></span><span>
</span><span id="line-596"></span><span>                </span><span class="annot"><span class="annottext">[instr] -&gt; [instr] -&gt; [instr]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[instr]
</span><a href="#local-6989586621681032308"><span class="hs-identifier hs-var">clobber_saves</span></a></span><span> </span><span class="annot"><span class="annottext">[instr] -&gt; [instr] -&gt; [instr]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[instr]
</span><a href="#local-6989586621681032331"><span class="hs-identifier hs-var">new_instrs</span></a></span><span>
</span><span id="line-597"></span><span>
</span><span id="line-598"></span><span class="hs-comment">--    pprTrace &quot;patched-code&quot; ((vcat $ map (docToSDoc . pprInstr) code)) $ do</span><span>
</span><span id="line-599"></span><span class="hs-comment">--    pprTrace &quot;pached-fixup&quot; ((ppr fixup_blocks)) $ do</span><span>
</span><span id="line-600"></span><span>
</span><span id="line-601"></span><span>    </span><span class="annot"><span class="annottext">([instr], [NatBasicBlock instr])
-&gt; RegM freeRegs ([instr], [NatBasicBlock instr])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[instr]
</span><a href="#local-6989586621681032283"><span class="hs-identifier hs-var">code</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[NatBasicBlock instr]
</span><a href="#local-6989586621681032306"><span class="hs-identifier hs-var">fixup_blocks</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-602"></span><span>
</span><span id="line-603"></span><span>  </span><span class="hs-special">}</span><span>
</span><span id="line-604"></span><span>
</span><span id="line-605"></span><span class="hs-comment">-- -----------------------------------------------------------------------------</span><span>
</span><span id="line-606"></span><span class="hs-comment">-- releaseRegs</span><span>
</span><span id="line-607"></span><span>
</span><span id="line-608"></span><span id="local-6989586621681032763"><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.html#releaseRegs"><span class="hs-identifier hs-type">releaseRegs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.FreeRegs.html#FR"><span class="hs-identifier hs-type">FR</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032763"><span class="hs-identifier hs-type">freeRegs</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Platform.Reg.html#Reg"><span class="hs-identifier hs-type">Reg</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.State.html#RegM"><span class="hs-identifier hs-type">RegM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032763"><span class="hs-identifier hs-type">freeRegs</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span></span><span>
</span><span id="line-609"></span><span id="releaseRegs"><span class="annot"><span class="annottext">releaseRegs :: forall freeRegs. FR freeRegs =&gt; [Reg] -&gt; RegM freeRegs ()
</span><a href="GHC.CmmToAsm.Reg.Linear.html#releaseRegs"><span class="hs-identifier hs-var hs-var">releaseRegs</span></a></span></span><span> </span><span id="local-6989586621681032277"><span class="annot"><span class="annottext">[Reg]
</span><a href="#local-6989586621681032277"><span class="hs-identifier hs-var">regs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-610"></span><span>  </span><span id="local-6989586621681032276"><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681032276"><span class="hs-identifier hs-var">platform</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">RegM freeRegs Platform
forall a. RegM a Platform
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#getPlatform"><span class="hs-identifier hs-var">getPlatform</span></a></span><span>
</span><span id="line-611"></span><span>  </span><span id="local-6989586621681032275"><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681032275"><span class="hs-identifier hs-var">assig</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">RegM freeRegs (RegMap Loc)
forall freeRegs. RegM freeRegs (RegMap Loc)
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#getAssigR"><span class="hs-identifier hs-var">getAssigR</span></a></span><span>
</span><span id="line-612"></span><span>  </span><span id="local-6989586621681032274"><span class="annot"><span class="annottext">freeRegs
</span><a href="#local-6989586621681032274"><span class="hs-identifier hs-var">free</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">RegM freeRegs freeRegs
forall freeRegs. RegM freeRegs freeRegs
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#getFreeRegsR"><span class="hs-identifier hs-var">getFreeRegsR</span></a></span><span>
</span><span id="line-613"></span><span>  </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681032261"><span class="annot"><span class="annottext">loop :: RegMap Loc -&gt; freeRegs -&gt; [Reg] -&gt; RegM freeRegs ()
</span><a href="#local-6989586621681032261"><span class="hs-identifier hs-var hs-var">loop</span></a></span></span><span> </span><span id="local-6989586621681032260"><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681032260"><span class="hs-identifier hs-var">assig</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621681032259"><span class="annot"><span class="annottext">freeRegs
</span><a href="#local-6989586621681032259"><span class="hs-identifier hs-var">free</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="annot"><span class="annottext">RegMap Loc -&gt; RegM freeRegs ()
forall freeRegs. RegMap Loc -&gt; RegM freeRegs ()
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#setAssigR"><span class="hs-identifier hs-var">setAssigR</span></a></span><span> </span><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681032260"><span class="hs-identifier hs-var">assig</span></a></span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">freeRegs -&gt; RegM freeRegs ()
forall freeRegs. freeRegs -&gt; RegM freeRegs ()
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#setFreeRegsR"><span class="hs-identifier hs-var">setFreeRegsR</span></a></span><span> </span><span class="annot"><span class="annottext">freeRegs
</span><a href="#local-6989586621681032259"><span class="hs-identifier hs-var">free</span></a></span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">() -&gt; RegM freeRegs ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-614"></span><span>      </span><span class="annot"><a href="#local-6989586621681032261"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span id="local-6989586621681032258"><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681032258"><span class="hs-identifier hs-var">assig</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621681032257"><span class="annot"><span class="annottext">freeRegs
</span><a href="#local-6989586621681032257"><span class="hs-identifier hs-var">free</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Platform.Reg.html#RegReal"><span class="hs-identifier hs-type">RegReal</span></a></span><span> </span><span id="local-6989586621681032256"><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032256"><span class="hs-identifier hs-var">rr</span></a></span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621681032255"><span class="annot"><span class="annottext">[Reg]
</span><a href="#local-6989586621681032255"><span class="hs-identifier hs-var">rs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RegMap Loc -&gt; freeRegs -&gt; [Reg] -&gt; RegM freeRegs ()
</span><a href="#local-6989586621681032261"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681032258"><span class="hs-identifier hs-var">assig</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform -&gt; RealReg -&gt; freeRegs -&gt; freeRegs
forall freeRegs.
FR freeRegs =&gt;
Platform -&gt; RealReg -&gt; freeRegs -&gt; freeRegs
</span><a href="GHC.CmmToAsm.Reg.Linear.FreeRegs.html#frReleaseReg"><span class="hs-identifier hs-var">frReleaseReg</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681032276"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032256"><span class="hs-identifier hs-var">rr</span></a></span><span> </span><span class="annot"><span class="annottext">freeRegs
</span><a href="#local-6989586621681032257"><span class="hs-identifier hs-var">free</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Reg]
</span><a href="#local-6989586621681032255"><span class="hs-identifier hs-var">rs</span></a></span><span>
</span><span id="line-615"></span><span>      </span><span class="annot"><a href="#local-6989586621681032261"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span id="local-6989586621681032253"><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681032253"><span class="hs-identifier hs-var">assig</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621681032252"><span class="annot"><span class="annottext">freeRegs
</span><a href="#local-6989586621681032252"><span class="hs-identifier hs-var">free</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681032251"><span class="annot"><span class="annottext">Reg
</span><a href="#local-6989586621681032251"><span class="hs-identifier hs-var">r</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621681032250"><span class="annot"><span class="annottext">[Reg]
</span><a href="#local-6989586621681032250"><span class="hs-identifier hs-var">rs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-616"></span><span>         </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">RegMap Loc -&gt; Reg -&gt; Maybe Loc
forall key elt. Uniquable key =&gt; UniqFM key elt -&gt; key -&gt; Maybe elt
</span><a href="GHC.Types.Unique.FM.html#lookupUFM"><span class="hs-identifier hs-var">lookupUFM</span></a></span><span> </span><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681032253"><span class="hs-identifier hs-var">assig</span></a></span><span> </span><span class="annot"><span class="annottext">Reg
</span><a href="#local-6989586621681032251"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-617"></span><span>         </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#InBoth"><span class="hs-identifier hs-type">InBoth</span></a></span><span> </span><span id="local-6989586621681032248"><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032248"><span class="hs-identifier hs-var">real</span></a></span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">RegMap Loc -&gt; freeRegs -&gt; [Reg] -&gt; RegM freeRegs ()
</span><a href="#local-6989586621681032261"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RegMap Loc -&gt; Reg -&gt; RegMap Loc
forall key elt.
Uniquable key =&gt;
UniqFM key elt -&gt; key -&gt; UniqFM key elt
</span><a href="GHC.Types.Unique.FM.html#delFromUFM"><span class="hs-identifier hs-var">delFromUFM</span></a></span><span> </span><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681032253"><span class="hs-identifier hs-var">assig</span></a></span><span> </span><span class="annot"><span class="annottext">Reg
</span><a href="#local-6989586621681032251"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-618"></span><span>                                      </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform -&gt; RealReg -&gt; freeRegs -&gt; freeRegs
forall freeRegs.
FR freeRegs =&gt;
Platform -&gt; RealReg -&gt; freeRegs -&gt; freeRegs
</span><a href="GHC.CmmToAsm.Reg.Linear.FreeRegs.html#frReleaseReg"><span class="hs-identifier hs-var">frReleaseReg</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681032276"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032248"><span class="hs-identifier hs-var">real</span></a></span><span> </span><span class="annot"><span class="annottext">freeRegs
</span><a href="#local-6989586621681032252"><span class="hs-identifier hs-var">free</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Reg]
</span><a href="#local-6989586621681032250"><span class="hs-identifier hs-var">rs</span></a></span><span>
</span><span id="line-619"></span><span>         </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#InReg"><span class="hs-identifier hs-type">InReg</span></a></span><span> </span><span id="local-6989586621681032247"><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032247"><span class="hs-identifier hs-var">real</span></a></span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">RegMap Loc -&gt; freeRegs -&gt; [Reg] -&gt; RegM freeRegs ()
</span><a href="#local-6989586621681032261"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RegMap Loc -&gt; Reg -&gt; RegMap Loc
forall key elt.
Uniquable key =&gt;
UniqFM key elt -&gt; key -&gt; UniqFM key elt
</span><a href="GHC.Types.Unique.FM.html#delFromUFM"><span class="hs-identifier hs-var">delFromUFM</span></a></span><span> </span><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681032253"><span class="hs-identifier hs-var">assig</span></a></span><span> </span><span class="annot"><span class="annottext">Reg
</span><a href="#local-6989586621681032251"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-620"></span><span>                                      </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform -&gt; RealReg -&gt; freeRegs -&gt; freeRegs
forall freeRegs.
FR freeRegs =&gt;
Platform -&gt; RealReg -&gt; freeRegs -&gt; freeRegs
</span><a href="GHC.CmmToAsm.Reg.Linear.FreeRegs.html#frReleaseReg"><span class="hs-identifier hs-var">frReleaseReg</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681032276"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032247"><span class="hs-identifier hs-var">real</span></a></span><span> </span><span class="annot"><span class="annottext">freeRegs
</span><a href="#local-6989586621681032252"><span class="hs-identifier hs-var">free</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Reg]
</span><a href="#local-6989586621681032250"><span class="hs-identifier hs-var">rs</span></a></span><span>
</span><span id="line-621"></span><span>         </span><span class="annot"><span class="annottext">Maybe Loc
</span><span class="hs-identifier">_</span></span><span>                    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">RegMap Loc -&gt; freeRegs -&gt; [Reg] -&gt; RegM freeRegs ()
</span><a href="#local-6989586621681032261"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RegMap Loc -&gt; Reg -&gt; RegMap Loc
forall key elt.
Uniquable key =&gt;
UniqFM key elt -&gt; key -&gt; UniqFM key elt
</span><a href="GHC.Types.Unique.FM.html#delFromUFM"><span class="hs-identifier hs-var">delFromUFM</span></a></span><span> </span><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681032253"><span class="hs-identifier hs-var">assig</span></a></span><span> </span><span class="annot"><span class="annottext">Reg
</span><a href="#local-6989586621681032251"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">freeRegs
</span><a href="#local-6989586621681032252"><span class="hs-identifier hs-var">free</span></a></span><span> </span><span class="annot"><span class="annottext">[Reg]
</span><a href="#local-6989586621681032250"><span class="hs-identifier hs-var">rs</span></a></span><span>
</span><span id="line-622"></span><span>  </span><span class="annot"><span class="annottext">RegMap Loc -&gt; freeRegs -&gt; [Reg] -&gt; RegM freeRegs ()
forall {freeRegs}.
FR freeRegs =&gt;
RegMap Loc -&gt; freeRegs -&gt; [Reg] -&gt; RegM freeRegs ()
</span><a href="#local-6989586621681032261"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681032275"><span class="hs-identifier hs-var">assig</span></a></span><span> </span><span class="annot"><span class="annottext">freeRegs
</span><a href="#local-6989586621681032274"><span class="hs-identifier hs-var">free</span></a></span><span> </span><span class="annot"><span class="annottext">[Reg]
</span><a href="#local-6989586621681032277"><span class="hs-identifier hs-var">regs</span></a></span><span>
</span><span id="line-623"></span><span>
</span><span id="line-624"></span><span>
</span><span id="line-625"></span><span class="hs-comment">-- -----------------------------------------------------------------------------</span><span>
</span><span id="line-626"></span><span class="hs-comment">-- Clobber real registers</span><span>
</span><span id="line-627"></span><span>
</span><span id="line-628"></span><span class="hs-comment">-- For each temp in a register that is going to be clobbered:</span><span>
</span><span id="line-629"></span><span class="hs-comment">--      - if the temp dies after this instruction, do nothing</span><span>
</span><span id="line-630"></span><span class="hs-comment">--      - otherwise, put it somewhere safe (another reg if possible,</span><span>
</span><span id="line-631"></span><span class="hs-comment">--              otherwise spill and record InBoth in the assignment).</span><span>
</span><span id="line-632"></span><span class="hs-comment">--      - for allocateRegs on the temps *read*,</span><span>
</span><span id="line-633"></span><span class="hs-comment">--      - clobbered regs are allocatable.</span><span>
</span><span id="line-634"></span><span class="hs-comment">--</span><span>
</span><span id="line-635"></span><span class="hs-comment">--      for allocateRegs on the temps *written*,</span><span>
</span><span id="line-636"></span><span class="hs-comment">--        - clobbered regs are not allocatable.</span><span>
</span><span id="line-637"></span><span class="hs-comment">--</span><span>
</span><span id="line-638"></span><span>
</span><span id="line-639"></span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.html#saveClobberedTemps"><span class="hs-identifier hs-type">saveClobberedTemps</span></a></span><span>
</span><span id="line-640"></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-keyword">forall</span><span> </span><span id="local-6989586621681032767"><span class="annot"><a href="#local-6989586621681032767"><span class="hs-identifier hs-type">instr</span></a></span></span><span> </span><span id="local-6989586621681032766"><span class="annot"><a href="#local-6989586621681032766"><span class="hs-identifier hs-type">freeRegs</span></a></span></span><span class="hs-operator">.</span><span>
</span><span id="line-641"></span><span>           </span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToAsm.Instr.html#Instruction"><span class="hs-identifier hs-type">Instruction</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032767"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.FreeRegs.html#FR"><span class="hs-identifier hs-type">FR</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032766"><span class="hs-identifier hs-type">freeRegs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-642"></span><span>        </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Platform.Reg.html#RealReg"><span class="hs-identifier hs-type">RealReg</span></a></span><span class="hs-special">]</span><span>            </span><span class="hs-comment">-- real registers clobbered by this instruction</span><span>
</span><span id="line-643"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Platform.Reg.html#Reg"><span class="hs-identifier hs-type">Reg</span></a></span><span class="hs-special">]</span><span>                </span><span class="hs-comment">-- registers which are no longer live after this insn</span><span>
</span><span id="line-644"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.State.html#RegM"><span class="hs-identifier hs-type">RegM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032766"><span class="hs-identifier hs-type">freeRegs</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621681032767"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">]</span><span>         </span><span class="hs-comment">-- return: instructions to spill any temps that will</span><span>
</span><span id="line-645"></span><span>                                </span><span class="hs-comment">-- be clobbered.</span><span>
</span><span id="line-646"></span><span>
</span><span id="line-647"></span><span id="saveClobberedTemps"><span class="annot"><span class="annottext">saveClobberedTemps :: forall instr freeRegs.
(Instruction instr, FR freeRegs) =&gt;
[RealReg] -&gt; [Reg] -&gt; RegM freeRegs [instr]
</span><a href="GHC.CmmToAsm.Reg.Linear.html#saveClobberedTemps"><span class="hs-identifier hs-var hs-var">saveClobberedTemps</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">[Reg]
</span><span class="hs-identifier">_</span></span><span>
</span><span id="line-648"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[instr] -&gt; RegM freeRegs [instr]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-649"></span><span>
</span><span id="line-650"></span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.html#saveClobberedTemps"><span class="hs-identifier hs-var">saveClobberedTemps</span></a></span><span> </span><span id="local-6989586621681032223"><span class="annot"><span class="annottext">[RealReg]
</span><a href="#local-6989586621681032223"><span class="hs-identifier hs-var">clobbered</span></a></span></span><span> </span><span id="local-6989586621681032222"><span class="annot"><span class="annottext">[Reg]
</span><a href="#local-6989586621681032222"><span class="hs-identifier hs-var">dying</span></a></span></span><span>
</span><span id="line-651"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-652"></span><span>        </span><span id="local-6989586621681032221"><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681032221"><span class="hs-identifier hs-var">assig</span></a></span></span><span>   </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">RegM freeRegs (RegMap Loc)
forall freeRegs. RegM freeRegs (RegMap Loc)
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#getAssigR"><span class="hs-identifier hs-var">getAssigR</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.State.html#RegM"><span class="hs-identifier hs-type">RegM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032766"><span class="hs-identifier hs-type">freeRegs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Unique.FM.html#UniqFM"><span class="hs-identifier hs-type">UniqFM</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#Reg"><span class="hs-identifier hs-type">Reg</span></a></span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#Loc"><span class="hs-identifier hs-type">Loc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-653"></span><span>        </span><span class="hs-comment">-- Unique represents the VirtualReg</span><span>
</span><span id="line-654"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span class="annot"><a href="#local-6989586621681032220"><span class="hs-identifier hs-type">to_spill</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Unique.html#Unique"><span class="hs-identifier hs-type">Unique</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#RealReg"><span class="hs-identifier hs-type">RealReg</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-655"></span><span>            </span><span id="local-6989586621681032220"><span class="annot"><span class="annottext">to_spill :: [(Unique, RealReg)]
</span><a href="#local-6989586621681032220"><span class="hs-identifier hs-var hs-var">to_spill</span></a></span></span><span>
</span><span id="line-656"></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Unique
</span><a href="#local-6989586621681032219"><span class="hs-identifier hs-var">temp</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032218"><span class="hs-identifier hs-var">reg</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-657"></span><span>                        </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681032219"><span class="annot"><span class="annottext">Unique
</span><a href="#local-6989586621681032219"><span class="hs-identifier hs-var">temp</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#InReg"><span class="hs-identifier hs-type">InReg</span></a></span><span> </span><span id="local-6989586621681032218"><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032218"><span class="hs-identifier hs-var">reg</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">RegMap Loc -&gt; [(Unique, Loc)]
forall key elt. UniqFM key elt -&gt; [(Unique, elt)]
</span><a href="GHC.Types.Unique.FM.html#nonDetUFMToList"><span class="hs-identifier hs-var">nonDetUFMToList</span></a></span><span> </span><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681032221"><span class="hs-identifier hs-var">assig</span></a></span><span>
</span><span id="line-658"></span><span>                        </span><span class="hs-comment">-- This is non-deterministic but we do not</span><span>
</span><span id="line-659"></span><span>                        </span><span class="hs-comment">-- currently support deterministic code-generation.</span><span>
</span><span id="line-660"></span><span>                        </span><span class="hs-comment">-- See Note [Unique Determinism and code generation]</span><span>
</span><span id="line-661"></span><span>                        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">(RealReg -&gt; Bool) -&gt; [RealReg] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#any"><span class="hs-identifier hs-var">any</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RealReg -&gt; RealReg -&gt; Bool
</span><a href="GHC.Platform.Reg.html#realRegsAlias"><span class="hs-identifier hs-var">realRegsAlias</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032218"><span class="hs-identifier hs-var">reg</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[RealReg]
</span><a href="#local-6989586621681032223"><span class="hs-identifier hs-var">clobbered</span></a></span><span>
</span><span id="line-662"></span><span>                        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="#local-6989586621681032219"><span class="hs-identifier hs-var">temp</span></a></span><span> </span><span class="annot"><span class="annottext">Unique -&gt; [Unique] -&gt; Bool
forall (t :: * -&gt; *) a. (Foldable t, Eq a) =&gt; a -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#notElem"><span class="hs-operator hs-var">`notElem`</span></a></span><span> </span><span class="annot"><span class="annottext">(Reg -&gt; Unique) -&gt; [Reg] -&gt; [Unique]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Reg -&gt; Unique
forall a. Uniquable a =&gt; a -&gt; Unique
</span><a href="GHC.Types.Unique.html#getUnique"><span class="hs-identifier hs-var">getUnique</span></a></span><span> </span><span class="annot"><span class="annottext">[Reg]
</span><a href="#local-6989586621681032222"><span class="hs-identifier hs-var">dying</span></a></span><span>  </span><span class="hs-special">]</span><span>
</span><span id="line-663"></span><span>
</span><span id="line-664"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621681032212"><span class="annot"><span class="annottext">[instr]
</span><a href="#local-6989586621681032212"><span class="hs-identifier hs-var">instrs</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621681032211"><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681032211"><span class="hs-identifier hs-var">assig'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">RegMap Loc
-&gt; [instr]
-&gt; [(Unique, RealReg)]
-&gt; RegM freeRegs ([instr], RegMap Loc)
</span><a href="#local-6989586621681032210"><span class="hs-identifier hs-var">clobber</span></a></span><span> </span><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681032221"><span class="hs-identifier hs-var">assig</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">[(Unique, RealReg)]
</span><a href="#local-6989586621681032220"><span class="hs-identifier hs-var">to_spill</span></a></span><span>
</span><span id="line-665"></span><span>        </span><span class="annot"><span class="annottext">RegMap Loc -&gt; RegM freeRegs ()
forall freeRegs. RegMap Loc -&gt; RegM freeRegs ()
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#setAssigR"><span class="hs-identifier hs-var">setAssigR</span></a></span><span> </span><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681032211"><span class="hs-identifier hs-var">assig'</span></a></span><span>
</span><span id="line-666"></span><span>        </span><span class="annot"><span class="annottext">[instr] -&gt; RegM freeRegs [instr]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">[instr]
</span><a href="#local-6989586621681032212"><span class="hs-identifier hs-var">instrs</span></a></span><span>
</span><span id="line-667"></span><span>
</span><span id="line-668"></span><span>   </span><span class="hs-keyword">where</span><span>
</span><span id="line-669"></span><span>     </span><span class="hs-comment">-- See Note [UniqFM and the register allocator]</span><span>
</span><span id="line-670"></span><span>     </span><span class="annot"><a href="#local-6989586621681032210"><span class="hs-identifier hs-type">clobber</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#RegMap"><span class="hs-identifier hs-type">RegMap</span></a></span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#Loc"><span class="hs-identifier hs-type">Loc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621681032767"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Unique.html#Unique"><span class="hs-identifier hs-type">Unique</span></a></span><span class="hs-special">,</span><span class="annot"><a href="GHC.Platform.Reg.html#RealReg"><span class="hs-identifier hs-type">RealReg</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.State.html#RegM"><span class="hs-identifier hs-type">RegM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032766"><span class="hs-identifier hs-type">freeRegs</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621681032767"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#RegMap"><span class="hs-identifier hs-type">RegMap</span></a></span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#Loc"><span class="hs-identifier hs-type">Loc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-671"></span><span>     </span><span id="local-6989586621681032210"><span class="annot"><span class="annottext">clobber :: RegMap Loc
-&gt; [instr]
-&gt; [(Unique, RealReg)]
-&gt; RegM freeRegs ([instr], RegMap Loc)
</span><a href="#local-6989586621681032210"><span class="hs-identifier hs-var hs-var">clobber</span></a></span></span><span> </span><span id="local-6989586621681032209"><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681032209"><span class="hs-identifier hs-var">assig</span></a></span></span><span> </span><span id="local-6989586621681032208"><span class="annot"><span class="annottext">[instr]
</span><a href="#local-6989586621681032208"><span class="hs-identifier hs-var">instrs</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-672"></span><span>            </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">([instr], RegMap Loc) -&gt; RegM freeRegs ([instr], RegMap Loc)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[instr]
</span><a href="#local-6989586621681032208"><span class="hs-identifier hs-var">instrs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681032209"><span class="hs-identifier hs-var">assig</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-673"></span><span>
</span><span id="line-674"></span><span>     </span><span class="annot"><a href="#local-6989586621681032210"><span class="hs-identifier hs-var">clobber</span></a></span><span> </span><span id="local-6989586621681032207"><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681032207"><span class="hs-identifier hs-var">assig</span></a></span></span><span> </span><span id="local-6989586621681032206"><span class="annot"><span class="annottext">[instr]
</span><a href="#local-6989586621681032206"><span class="hs-identifier hs-var">instrs</span></a></span></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span id="local-6989586621681032205"><span class="annot"><span class="annottext">Unique
</span><a href="#local-6989586621681032205"><span class="hs-identifier hs-var">temp</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681032204"><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032204"><span class="hs-identifier hs-var">reg</span></a></span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621681032203"><span class="annot"><span class="annottext">[(Unique, RealReg)]
</span><a href="#local-6989586621681032203"><span class="hs-identifier hs-var">rest</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-675"></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621681032202"><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681032202"><span class="hs-identifier hs-var">platform</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">RegM freeRegs Platform
forall a. RegM a Platform
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#getPlatform"><span class="hs-identifier hs-var">getPlatform</span></a></span><span>
</span><span id="line-676"></span><span>
</span><span id="line-677"></span><span>            </span><span id="local-6989586621681032201"><span class="annot"><span class="annottext">freeRegs
</span><a href="#local-6989586621681032201"><span class="hs-identifier hs-var">freeRegs</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">RegM freeRegs freeRegs
forall freeRegs. RegM freeRegs freeRegs
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#getFreeRegsR"><span class="hs-identifier hs-var">getFreeRegsR</span></a></span><span>
</span><span id="line-678"></span><span>            </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681032200"><span class="annot"><span class="annottext">regclass :: RegClass
</span><a href="#local-6989586621681032200"><span class="hs-identifier hs-var hs-var">regclass</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Platform -&gt; RealReg -&gt; RegClass
</span><a href="GHC.CmmToAsm.Reg.Target.html#targetClassOfRealReg"><span class="hs-identifier hs-var">targetClassOfRealReg</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681032202"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032204"><span class="hs-identifier hs-var">reg</span></a></span><span>
</span><span id="line-679"></span><span>                </span><span id="local-6989586621681032197"><span class="annot"><span class="annottext">freeRegs_thisClass :: [RealReg]
</span><a href="#local-6989586621681032197"><span class="hs-identifier hs-var hs-var">freeRegs_thisClass</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Platform -&gt; RegClass -&gt; freeRegs -&gt; [RealReg]
forall freeRegs.
FR freeRegs =&gt;
Platform -&gt; RegClass -&gt; freeRegs -&gt; [RealReg]
</span><a href="GHC.CmmToAsm.Reg.Linear.FreeRegs.html#frGetFreeRegs"><span class="hs-identifier hs-var">frGetFreeRegs</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681032202"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="annot"><span class="annottext">RegClass
</span><a href="#local-6989586621681032200"><span class="hs-identifier hs-var">regclass</span></a></span><span> </span><span class="annot"><span class="annottext">freeRegs
</span><a href="#local-6989586621681032201"><span class="hs-identifier hs-var">freeRegs</span></a></span><span>
</span><span id="line-680"></span><span>
</span><span id="line-681"></span><span>            </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">(RealReg -&gt; Bool) -&gt; [RealReg] -&gt; [RealReg]
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#filter"><span class="hs-identifier hs-var">filter</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RealReg -&gt; [RealReg] -&gt; Bool
forall (t :: * -&gt; *) a. (Foldable t, Eq a) =&gt; a -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#notElem"><span class="hs-operator hs-var">`notElem`</span></a></span><span> </span><span class="annot"><span class="annottext">[RealReg]
</span><a href="#local-6989586621681032223"><span class="hs-identifier hs-var">clobbered</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[RealReg]
</span><a href="#local-6989586621681032197"><span class="hs-identifier hs-var">freeRegs_thisClass</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-682"></span><span>
</span><span id="line-683"></span><span>              </span><span class="hs-comment">-- (1) we have a free reg of the right class that isn't</span><span>
</span><span id="line-684"></span><span>              </span><span class="hs-comment">-- clobbered by this instruction; use it to save the</span><span>
</span><span id="line-685"></span><span>              </span><span class="hs-comment">-- clobbered value.</span><span>
</span><span id="line-686"></span><span>              </span><span class="hs-special">(</span><span id="local-6989586621681032195"><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032195"><span class="hs-identifier hs-var">my_reg</span></a></span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span class="annot"><span class="annottext">[RealReg]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-687"></span><span>                  </span><span class="annot"><span class="annottext">freeRegs -&gt; RegM freeRegs ()
forall freeRegs. freeRegs -&gt; RegM freeRegs ()
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#setFreeRegsR"><span class="hs-identifier hs-var">setFreeRegsR</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform -&gt; RealReg -&gt; freeRegs -&gt; freeRegs
forall freeRegs.
FR freeRegs =&gt;
Platform -&gt; RealReg -&gt; freeRegs -&gt; freeRegs
</span><a href="GHC.CmmToAsm.Reg.Linear.FreeRegs.html#frAllocateReg"><span class="hs-identifier hs-var">frAllocateReg</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681032202"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032195"><span class="hs-identifier hs-var">my_reg</span></a></span><span> </span><span class="annot"><span class="annottext">freeRegs
</span><a href="#local-6989586621681032201"><span class="hs-identifier hs-var">freeRegs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-688"></span><span>
</span><span id="line-689"></span><span>                  </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681032194"><span class="annot"><span class="annottext">new_assign :: RegMap Loc
</span><a href="#local-6989586621681032194"><span class="hs-identifier hs-var hs-var">new_assign</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RegMap Loc -&gt; Unique -&gt; Loc -&gt; RegMap Loc
forall key elt. UniqFM key elt -&gt; Unique -&gt; elt -&gt; UniqFM key elt
</span><a href="GHC.Types.Unique.FM.html#addToUFM_Directly"><span class="hs-identifier hs-var">addToUFM_Directly</span></a></span><span> </span><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681032207"><span class="hs-identifier hs-var">assig</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="#local-6989586621681032205"><span class="hs-identifier hs-var">temp</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RealReg -&gt; Loc
</span><a href="GHC.CmmToAsm.Reg.Linear.Base.html#InReg"><span class="hs-identifier hs-var">InReg</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032195"><span class="hs-identifier hs-var">my_reg</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-690"></span><span>                  </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681032191"><span class="annot"><span class="annottext">instr :: instr
</span><a href="#local-6989586621681032191"><span class="hs-identifier hs-var hs-var">instr</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Platform -&gt; Reg -&gt; Reg -&gt; instr
forall instr. Instruction instr =&gt; Platform -&gt; Reg -&gt; Reg -&gt; instr
</span><a href="GHC.CmmToAsm.Instr.html#mkRegRegMoveInstr"><span class="hs-identifier hs-var">mkRegRegMoveInstr</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681032202"><span class="hs-identifier hs-var">platform</span></a></span><span>
</span><span id="line-691"></span><span>                                  </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RealReg -&gt; Reg
</span><a href="GHC.Platform.Reg.html#RegReal"><span class="hs-identifier hs-var">RegReal</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032204"><span class="hs-identifier hs-var">reg</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RealReg -&gt; Reg
</span><a href="GHC.Platform.Reg.html#RegReal"><span class="hs-identifier hs-var">RegReal</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032195"><span class="hs-identifier hs-var">my_reg</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-692"></span><span>
</span><span id="line-693"></span><span>                  </span><span class="annot"><span class="annottext">RegMap Loc
-&gt; [instr]
-&gt; [(Unique, RealReg)]
-&gt; RegM freeRegs ([instr], RegMap Loc)
</span><a href="#local-6989586621681032210"><span class="hs-identifier hs-var">clobber</span></a></span><span> </span><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681032194"><span class="hs-identifier hs-var">new_assign</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">instr
</span><a href="#local-6989586621681032191"><span class="hs-identifier hs-var">instr</span></a></span><span> </span><span class="annot"><span class="annottext">instr -&gt; [instr] -&gt; [instr]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[instr]
</span><a href="#local-6989586621681032206"><span class="hs-identifier hs-var">instrs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[(Unique, RealReg)]
</span><a href="#local-6989586621681032203"><span class="hs-identifier hs-var">rest</span></a></span><span>
</span><span id="line-694"></span><span>
</span><span id="line-695"></span><span>              </span><span class="hs-comment">-- (2) no free registers: spill the value</span><span>
</span><span id="line-696"></span><span>              </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-697"></span><span>                  </span><span class="hs-special">(</span><span id="local-6989586621681032189"><span class="annot"><span class="annottext">instr
</span><a href="#local-6989586621681032189"><span class="hs-identifier hs-var">spill</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681032188"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681032188"><span class="hs-identifier hs-var">slot</span></a></span></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Reg -&gt; Unique -&gt; RegM freeRegs (instr, Int)
forall instr freeRegs.
Instruction instr =&gt;
Reg -&gt; Unique -&gt; RegM freeRegs (instr, Int)
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#spillR"><span class="hs-identifier hs-var">spillR</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RealReg -&gt; Reg
</span><a href="GHC.Platform.Reg.html#RegReal"><span class="hs-identifier hs-var">RegReal</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032204"><span class="hs-identifier hs-var">reg</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="#local-6989586621681032205"><span class="hs-identifier hs-var">temp</span></a></span><span>
</span><span id="line-698"></span><span>
</span><span id="line-699"></span><span>                  </span><span class="hs-comment">-- record why this reg was spilled for profiling</span><span>
</span><span id="line-700"></span><span>                  </span><span class="annot"><span class="annottext">SpillReason -&gt; RegM freeRegs ()
forall freeRegs. SpillReason -&gt; RegM freeRegs ()
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#recordSpill"><span class="hs-identifier hs-var">recordSpill</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Unique -&gt; SpillReason
</span><a href="GHC.CmmToAsm.Reg.Linear.Base.html#SpillClobber"><span class="hs-identifier hs-var">SpillClobber</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="#local-6989586621681032205"><span class="hs-identifier hs-var">temp</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-701"></span><span>
</span><span id="line-702"></span><span>                  </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681032184"><span class="annot"><span class="annottext">new_assign :: RegMap Loc
</span><a href="#local-6989586621681032184"><span class="hs-identifier hs-var hs-var">new_assign</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RegMap Loc -&gt; Unique -&gt; Loc -&gt; RegMap Loc
forall key elt. UniqFM key elt -&gt; Unique -&gt; elt -&gt; UniqFM key elt
</span><a href="GHC.Types.Unique.FM.html#addToUFM_Directly"><span class="hs-identifier hs-var">addToUFM_Directly</span></a></span><span> </span><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681032207"><span class="hs-identifier hs-var">assig</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="#local-6989586621681032205"><span class="hs-identifier hs-var">temp</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RealReg -&gt; Int -&gt; Loc
</span><a href="GHC.CmmToAsm.Reg.Linear.Base.html#InBoth"><span class="hs-identifier hs-var">InBoth</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032204"><span class="hs-identifier hs-var">reg</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681032188"><span class="hs-identifier hs-var">slot</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-703"></span><span>
</span><span id="line-704"></span><span>                  </span><span class="annot"><span class="annottext">RegMap Loc
-&gt; [instr]
-&gt; [(Unique, RealReg)]
-&gt; RegM freeRegs ([instr], RegMap Loc)
</span><a href="#local-6989586621681032210"><span class="hs-identifier hs-var">clobber</span></a></span><span> </span><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681032184"><span class="hs-identifier hs-var">new_assign</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">instr
</span><a href="#local-6989586621681032189"><span class="hs-identifier hs-var">spill</span></a></span><span> </span><span class="annot"><span class="annottext">instr -&gt; [instr] -&gt; [instr]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[instr]
</span><a href="#local-6989586621681032206"><span class="hs-identifier hs-var">instrs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[(Unique, RealReg)]
</span><a href="#local-6989586621681032203"><span class="hs-identifier hs-var">rest</span></a></span><span>
</span><span id="line-705"></span><span>
</span><span id="line-706"></span><span>
</span><span id="line-707"></span><span>
</span><span id="line-708"></span><span class="hs-comment">-- | Mark all these real regs as allocated,</span><span>
</span><span id="line-709"></span><span class="hs-comment">--      and kick out their vreg assignments.</span><span>
</span><span id="line-710"></span><span class="hs-comment">--</span><span>
</span><span id="line-711"></span><span id="local-6989586621681032762"><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.html#clobberRegs"><span class="hs-identifier hs-type">clobberRegs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.FreeRegs.html#FR"><span class="hs-identifier hs-type">FR</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032762"><span class="hs-identifier hs-type">freeRegs</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Platform.Reg.html#RealReg"><span class="hs-identifier hs-type">RealReg</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.State.html#RegM"><span class="hs-identifier hs-type">RegM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032762"><span class="hs-identifier hs-type">freeRegs</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span></span><span>
</span><span id="line-712"></span><span id="clobberRegs"><span class="annot"><span class="annottext">clobberRegs :: forall freeRegs. FR freeRegs =&gt; [RealReg] -&gt; RegM freeRegs ()
</span><a href="GHC.CmmToAsm.Reg.Linear.html#clobberRegs"><span class="hs-identifier hs-var hs-var">clobberRegs</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-713"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">() -&gt; RegM freeRegs ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-714"></span><span>
</span><span id="line-715"></span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.html#clobberRegs"><span class="hs-identifier hs-var">clobberRegs</span></a></span><span> </span><span id="local-6989586621681032174"><span class="annot"><span class="annottext">[RealReg]
</span><a href="#local-6989586621681032174"><span class="hs-identifier hs-var">clobbered</span></a></span></span><span>
</span><span id="line-716"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>   </span><span id="local-6989586621681032173"><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681032173"><span class="hs-identifier hs-var">platform</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">RegM freeRegs Platform
forall a. RegM a Platform
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#getPlatform"><span class="hs-identifier hs-var">getPlatform</span></a></span><span>
</span><span id="line-717"></span><span>        </span><span id="local-6989586621681032172"><span class="annot"><span class="annottext">freeRegs
</span><a href="#local-6989586621681032172"><span class="hs-identifier hs-var">freeregs</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">RegM freeRegs freeRegs
forall freeRegs. RegM freeRegs freeRegs
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#getFreeRegsR"><span class="hs-identifier hs-var">getFreeRegsR</span></a></span><span>
</span><span id="line-718"></span><span>        </span><span class="annot"><span class="annottext">freeRegs -&gt; RegM freeRegs ()
forall freeRegs. freeRegs -&gt; RegM freeRegs ()
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#setFreeRegsR"><span class="hs-identifier hs-var">setFreeRegsR</span></a></span><span> </span><span class="annot"><span class="annottext">(freeRegs -&gt; RegM freeRegs ()) -&gt; freeRegs -&gt; RegM freeRegs ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="annot"><span class="annottext">(freeRegs -&gt; RealReg -&gt; freeRegs)
-&gt; freeRegs -&gt; [RealReg] -&gt; freeRegs
forall (t :: * -&gt; *) b a.
Foldable t =&gt;
(b -&gt; a -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldl%27"><span class="hs-identifier hs-var">foldl'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(RealReg -&gt; freeRegs -&gt; freeRegs)
-&gt; freeRegs -&gt; RealReg -&gt; freeRegs
forall a b c. (a -&gt; b -&gt; c) -&gt; b -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#flip"><span class="hs-identifier hs-var">flip</span></a></span><span> </span><span class="annot"><span class="annottext">((RealReg -&gt; freeRegs -&gt; freeRegs)
 -&gt; freeRegs -&gt; RealReg -&gt; freeRegs)
-&gt; (RealReg -&gt; freeRegs -&gt; freeRegs)
-&gt; freeRegs
-&gt; RealReg
-&gt; freeRegs
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Platform -&gt; RealReg -&gt; freeRegs -&gt; freeRegs
forall freeRegs.
FR freeRegs =&gt;
Platform -&gt; RealReg -&gt; freeRegs -&gt; freeRegs
</span><a href="GHC.CmmToAsm.Reg.Linear.FreeRegs.html#frAllocateReg"><span class="hs-identifier hs-var">frAllocateReg</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681032173"><span class="hs-identifier hs-var">platform</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">freeRegs
</span><a href="#local-6989586621681032172"><span class="hs-identifier hs-var">freeregs</span></a></span><span> </span><span class="annot"><span class="annottext">[RealReg]
</span><a href="#local-6989586621681032174"><span class="hs-identifier hs-var">clobbered</span></a></span><span>
</span><span id="line-719"></span><span>
</span><span id="line-720"></span><span>        </span><span id="local-6989586621681032170"><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681032170"><span class="hs-identifier hs-var">assig</span></a></span></span><span>           </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">RegM freeRegs (RegMap Loc)
forall freeRegs. RegM freeRegs (RegMap Loc)
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#getAssigR"><span class="hs-identifier hs-var">getAssigR</span></a></span><span>
</span><span id="line-721"></span><span>        </span><span class="annot"><span class="annottext">RegMap Loc -&gt; RegM freeRegs ()
forall freeRegs. RegMap Loc -&gt; RegM freeRegs ()
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#setAssigR"><span class="hs-identifier hs-var">setAssigR</span></a></span><span> </span><span class="annot"><span class="annottext">(RegMap Loc -&gt; RegM freeRegs ()) -&gt; RegMap Loc -&gt; RegM freeRegs ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="annot"><span class="annottext">RegMap Loc -&gt; [(Unique, Loc)] -&gt; RegMap Loc
</span><a href="#local-6989586621681032169"><span class="hs-identifier hs-var">clobber</span></a></span><span> </span><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681032170"><span class="hs-identifier hs-var">assig</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RegMap Loc -&gt; [(Unique, Loc)]
forall key elt. UniqFM key elt -&gt; [(Unique, elt)]
</span><a href="GHC.Types.Unique.FM.html#nonDetUFMToList"><span class="hs-identifier hs-var">nonDetUFMToList</span></a></span><span> </span><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681032170"><span class="hs-identifier hs-var">assig</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-722"></span><span>          </span><span class="hs-comment">-- This is non-deterministic but we do not</span><span>
</span><span id="line-723"></span><span>          </span><span class="hs-comment">-- currently support deterministic code-generation.</span><span>
</span><span id="line-724"></span><span>          </span><span class="hs-comment">-- See Note [Unique Determinism and code generation]</span><span>
</span><span id="line-725"></span><span>
</span><span id="line-726"></span><span>   </span><span class="hs-keyword">where</span><span>
</span><span id="line-727"></span><span>        </span><span class="hs-comment">-- if the temp was InReg and clobbered, then we will have</span><span>
</span><span id="line-728"></span><span>        </span><span class="hs-comment">-- saved it in saveClobberedTemps above.  So the only case</span><span>
</span><span id="line-729"></span><span>        </span><span class="hs-comment">-- we have to worry about here is InBoth.  Note that this</span><span>
</span><span id="line-730"></span><span>        </span><span class="hs-comment">-- also catches temps which were loaded up during allocation</span><span>
</span><span id="line-731"></span><span>        </span><span class="hs-comment">-- of read registers, not just those saved in saveClobberedTemps.</span><span>
</span><span id="line-732"></span><span>
</span><span id="line-733"></span><span>        </span><span class="annot"><a href="#local-6989586621681032169"><span class="hs-identifier hs-type">clobber</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#RegMap"><span class="hs-identifier hs-type">RegMap</span></a></span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#Loc"><span class="hs-identifier hs-type">Loc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Unique.html#Unique"><span class="hs-identifier hs-type">Unique</span></a></span><span class="hs-special">,</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#Loc"><span class="hs-identifier hs-type">Loc</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#RegMap"><span class="hs-identifier hs-type">RegMap</span></a></span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#Loc"><span class="hs-identifier hs-type">Loc</span></a></span><span>
</span><span id="line-734"></span><span>        </span><span id="local-6989586621681032169"><span class="annot"><span class="annottext">clobber :: RegMap Loc -&gt; [(Unique, Loc)] -&gt; RegMap Loc
</span><a href="#local-6989586621681032169"><span class="hs-identifier hs-var hs-var">clobber</span></a></span></span><span> </span><span id="local-6989586621681032168"><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681032168"><span class="hs-identifier hs-var">assig</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-735"></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681032168"><span class="hs-identifier hs-var">assig</span></a></span><span>
</span><span id="line-736"></span><span>
</span><span id="line-737"></span><span>        </span><span class="annot"><a href="#local-6989586621681032169"><span class="hs-identifier hs-var">clobber</span></a></span><span> </span><span id="local-6989586621681032167"><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681032167"><span class="hs-identifier hs-var">assig</span></a></span></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span id="local-6989586621681032166"><span class="annot"><span class="annottext">Unique
</span><a href="#local-6989586621681032166"><span class="hs-identifier hs-var">temp</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#InBoth"><span class="hs-identifier hs-type">InBoth</span></a></span><span> </span><span id="local-6989586621681032165"><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032165"><span class="hs-identifier hs-var">reg</span></a></span></span><span> </span><span id="local-6989586621681032164"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681032164"><span class="hs-identifier hs-var">slot</span></a></span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621681032163"><span class="annot"><span class="annottext">[(Unique, Loc)]
</span><a href="#local-6989586621681032163"><span class="hs-identifier hs-var">rest</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-738"></span><span>                </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">(RealReg -&gt; Bool) -&gt; [RealReg] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#any"><span class="hs-identifier hs-var">any</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RealReg -&gt; RealReg -&gt; Bool
</span><a href="GHC.Platform.Reg.html#realRegsAlias"><span class="hs-identifier hs-var">realRegsAlias</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032165"><span class="hs-identifier hs-var">reg</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[RealReg]
</span><a href="#local-6989586621681032174"><span class="hs-identifier hs-var">clobbered</span></a></span><span>
</span><span id="line-739"></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RegMap Loc -&gt; [(Unique, Loc)] -&gt; RegMap Loc
</span><a href="#local-6989586621681032169"><span class="hs-identifier hs-var">clobber</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RegMap Loc -&gt; Unique -&gt; Loc -&gt; RegMap Loc
forall key elt. UniqFM key elt -&gt; Unique -&gt; elt -&gt; UniqFM key elt
</span><a href="GHC.Types.Unique.FM.html#addToUFM_Directly"><span class="hs-identifier hs-var">addToUFM_Directly</span></a></span><span> </span><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681032167"><span class="hs-identifier hs-var">assig</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="#local-6989586621681032166"><span class="hs-identifier hs-var">temp</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Loc
</span><a href="GHC.CmmToAsm.Reg.Linear.Base.html#InMem"><span class="hs-identifier hs-var">InMem</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681032164"><span class="hs-identifier hs-var">slot</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[(Unique, Loc)]
</span><a href="#local-6989586621681032163"><span class="hs-identifier hs-var">rest</span></a></span><span>
</span><span id="line-740"></span><span>
</span><span id="line-741"></span><span>        </span><span class="annot"><a href="#local-6989586621681032169"><span class="hs-identifier hs-var">clobber</span></a></span><span> </span><span id="local-6989586621681032161"><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681032161"><span class="hs-identifier hs-var">assig</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Unique, Loc)
</span><span class="hs-identifier">_</span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621681032160"><span class="annot"><span class="annottext">[(Unique, Loc)]
</span><a href="#local-6989586621681032160"><span class="hs-identifier hs-var">rest</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-742"></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RegMap Loc -&gt; [(Unique, Loc)] -&gt; RegMap Loc
</span><a href="#local-6989586621681032169"><span class="hs-identifier hs-var">clobber</span></a></span><span> </span><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681032161"><span class="hs-identifier hs-var">assig</span></a></span><span> </span><span class="annot"><span class="annottext">[(Unique, Loc)]
</span><a href="#local-6989586621681032160"><span class="hs-identifier hs-var">rest</span></a></span><span>
</span><span id="line-743"></span><span>
</span><span id="line-744"></span><span class="hs-comment">-- -----------------------------------------------------------------------------</span><span>
</span><span id="line-745"></span><span class="hs-comment">-- allocateRegsAndSpill</span><span>
</span><span id="line-746"></span><span>
</span><span id="line-747"></span><span class="hs-comment">-- Why are we performing a spill?</span><span>
</span><span id="line-748"></span><span class="hs-keyword">data</span><span> </span><span id="SpillLoc"><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.html#SpillLoc"><span class="hs-identifier hs-var">SpillLoc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="ReadMem"><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.html#ReadMem"><span class="hs-identifier hs-var">ReadMem</span></a></span></span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.StackMap.html#StackSlot"><span class="hs-identifier hs-type">StackSlot</span></a></span><span>  </span><span class="hs-comment">-- reading from register only in memory</span><span>
</span><span id="line-749"></span><span>              </span><span class="hs-glyph">|</span><span> </span><span id="WriteNew"><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.html#WriteNew"><span class="hs-identifier hs-var">WriteNew</span></a></span></span><span>           </span><span class="hs-comment">-- writing to a new variable</span><span>
</span><span id="line-750"></span><span>              </span><span class="hs-glyph">|</span><span> </span><span id="WriteMem"><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.html#WriteMem"><span class="hs-identifier hs-var">WriteMem</span></a></span></span><span>           </span><span class="hs-comment">-- writing to register only in memory</span><span>
</span><span id="line-751"></span><span class="hs-comment">-- Note that ReadNew is not valid, since you don't want to be reading</span><span>
</span><span id="line-752"></span><span class="hs-comment">-- from an uninitialized register.  We also don't need the location of</span><span>
</span><span id="line-753"></span><span class="hs-comment">-- the register in memory, since that will be invalidated by the write.</span><span>
</span><span id="line-754"></span><span class="hs-comment">-- Technically, we could coalesce WriteNew and WriteMem into a single</span><span>
</span><span id="line-755"></span><span class="hs-comment">-- entry as well. -- EZY</span><span>
</span><span id="line-756"></span><span>
</span><span id="line-757"></span><span class="hs-comment">-- This function does several things:</span><span>
</span><span id="line-758"></span><span class="hs-comment">--   For each temporary referred to by this instruction,</span><span>
</span><span id="line-759"></span><span class="hs-comment">--   we allocate a real register (spilling another temporary if necessary).</span><span>
</span><span id="line-760"></span><span class="hs-comment">--   We load the temporary up from memory if necessary.</span><span>
</span><span id="line-761"></span><span class="hs-comment">--   We also update the register assignment in the process, and</span><span>
</span><span id="line-762"></span><span class="hs-comment">--   the list of free registers and free stack slots.</span><span>
</span><span id="line-763"></span><span>
</span><span id="line-764"></span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.html#allocateRegsAndSpill"><span class="hs-identifier hs-type">allocateRegsAndSpill</span></a></span><span>
</span><span id="line-765"></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-keyword">forall</span><span> </span><span id="local-6989586621681032769"><span class="annot"><a href="#local-6989586621681032769"><span class="hs-identifier hs-type">freeRegs</span></a></span></span><span> </span><span id="local-6989586621681032768"><span class="annot"><a href="#local-6989586621681032768"><span class="hs-identifier hs-type">instr</span></a></span></span><span class="hs-operator">.</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.FreeRegs.html#FR"><span class="hs-identifier hs-type">FR</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032769"><span class="hs-identifier hs-type">freeRegs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032768"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Instr.html#Instruction"><span class="hs-identifier hs-type">Instruction</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032768"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-766"></span><span>        </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>                 </span><span class="hs-comment">-- True &lt;=&gt; reading (load up spilled regs)</span><span>
</span><span id="line-767"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Platform.Reg.html#VirtualReg"><span class="hs-identifier hs-type">VirtualReg</span></a></span><span class="hs-special">]</span><span>         </span><span class="hs-comment">-- don't push these out</span><span>
</span><span id="line-768"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621681032768"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">]</span><span>              </span><span class="hs-comment">-- spill insns</span><span>
</span><span id="line-769"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Platform.Reg.html#RealReg"><span class="hs-identifier hs-type">RealReg</span></a></span><span class="hs-special">]</span><span>            </span><span class="hs-comment">-- real registers allocated (accum.)</span><span>
</span><span id="line-770"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Platform.Reg.html#VirtualReg"><span class="hs-identifier hs-type">VirtualReg</span></a></span><span class="hs-special">]</span><span>         </span><span class="hs-comment">-- temps to allocate</span><span>
</span><span id="line-771"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.State.html#RegM"><span class="hs-identifier hs-type">RegM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032769"><span class="hs-identifier hs-type">freeRegs</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621681032768"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Platform.Reg.html#RealReg"><span class="hs-identifier hs-type">RealReg</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-772"></span><span>
</span><span id="line-773"></span><span id="allocateRegsAndSpill"><span class="annot"><span class="annottext">allocateRegsAndSpill :: forall freeRegs instr.
(FR freeRegs, Outputable instr, Instruction instr) =&gt;
Bool
-&gt; [VirtualReg]
-&gt; [instr]
-&gt; [RealReg]
-&gt; [VirtualReg]
-&gt; RegM freeRegs ([instr], [RealReg])
</span><a href="GHC.CmmToAsm.Reg.Linear.html#allocateRegsAndSpill"><span class="hs-identifier hs-var hs-var">allocateRegsAndSpill</span></a></span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier">_</span></span><span>       </span><span class="annot"><span class="annottext">[VirtualReg]
</span><span class="hs-identifier">_</span></span><span>    </span><span id="local-6989586621681032133"><span class="annot"><span class="annottext">[instr]
</span><a href="#local-6989586621681032133"><span class="hs-identifier hs-var">spills</span></a></span></span><span> </span><span id="local-6989586621681032132"><span class="annot"><span class="annottext">[RealReg]
</span><a href="#local-6989586621681032132"><span class="hs-identifier hs-var">alloc</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-774"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">([instr], [RealReg]) -&gt; RegM freeRegs ([instr], [RealReg])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[instr]
</span><a href="#local-6989586621681032133"><span class="hs-identifier hs-var">spills</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[RealReg] -&gt; [RealReg]
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="annot"><span class="annottext">[RealReg]
</span><a href="#local-6989586621681032132"><span class="hs-identifier hs-var">alloc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-775"></span><span>
</span><span id="line-776"></span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.html#allocateRegsAndSpill"><span class="hs-identifier hs-var">allocateRegsAndSpill</span></a></span><span> </span><span id="local-6989586621681032131"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681032131"><span class="hs-identifier hs-var">reading</span></a></span></span><span> </span><span id="local-6989586621681032130"><span class="annot"><span class="annottext">[VirtualReg]
</span><a href="#local-6989586621681032130"><span class="hs-identifier hs-var">keep</span></a></span></span><span> </span><span id="local-6989586621681032129"><span class="annot"><span class="annottext">[instr]
</span><a href="#local-6989586621681032129"><span class="hs-identifier hs-var">spills</span></a></span></span><span> </span><span id="local-6989586621681032128"><span class="annot"><span class="annottext">[RealReg]
</span><a href="#local-6989586621681032128"><span class="hs-identifier hs-var">alloc</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681032127"><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681032127"><span class="hs-identifier hs-var">r</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621681032126"><span class="annot"><span class="annottext">[VirtualReg]
</span><a href="#local-6989586621681032126"><span class="hs-identifier hs-var">rs</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-777"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>   </span><span id="local-6989586621681032125"><span class="annot"><span class="annottext">UniqFM VirtualReg Loc
</span><a href="#local-6989586621681032125"><span class="hs-identifier hs-var">assig</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">RegMap Loc -&gt; UniqFM VirtualReg Loc
forall elt. UniqFM Reg elt -&gt; UniqFM VirtualReg elt
</span><a href="GHC.CmmToAsm.Reg.Utils.html#toVRegMap"><span class="hs-identifier hs-var">toVRegMap</span></a></span><span> </span><span class="annot"><span class="annottext">(RegMap Loc -&gt; UniqFM VirtualReg Loc)
-&gt; RegM freeRegs (RegMap Loc)
-&gt; RegM freeRegs (UniqFM VirtualReg Loc)
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">RegM freeRegs (RegMap Loc)
forall freeRegs. RegM freeRegs (RegMap Loc)
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#getAssigR"><span class="hs-identifier hs-var">getAssigR</span></a></span><span>
</span><span id="line-778"></span><span>        </span><span class="hs-comment">-- pprTraceM &quot;allocateRegsAndSpill:assig&quot; (ppr (r:rs) $$ ppr assig)</span><span>
</span><span id="line-779"></span><span>        </span><span class="hs-comment">-- See Note [UniqFM and the register allocator]</span><span>
</span><span id="line-780"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681032119"><span class="annot"><span class="annottext">doSpill :: SpillLoc -&gt; RegM freeRegs ([instr], [RealReg])
</span><a href="#local-6989586621681032119"><span class="hs-identifier hs-var hs-var">doSpill</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
-&gt; [VirtualReg]
-&gt; [instr]
-&gt; [RealReg]
-&gt; VirtualReg
-&gt; [VirtualReg]
-&gt; UniqFM VirtualReg Loc
-&gt; SpillLoc
-&gt; RegM freeRegs ([instr], [RealReg])
forall freeRegs instr.
(FR freeRegs, Instruction instr, Outputable instr) =&gt;
Bool
-&gt; [VirtualReg]
-&gt; [instr]
-&gt; [RealReg]
-&gt; VirtualReg
-&gt; [VirtualReg]
-&gt; UniqFM VirtualReg Loc
-&gt; SpillLoc
-&gt; RegM freeRegs ([instr], [RealReg])
</span><a href="GHC.CmmToAsm.Reg.Linear.html#allocRegsAndSpill_spill"><span class="hs-identifier hs-var">allocRegsAndSpill_spill</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681032131"><span class="hs-identifier hs-var">reading</span></a></span><span> </span><span class="annot"><span class="annottext">[VirtualReg]
</span><a href="#local-6989586621681032130"><span class="hs-identifier hs-var">keep</span></a></span><span> </span><span class="annot"><span class="annottext">[instr]
</span><a href="#local-6989586621681032129"><span class="hs-identifier hs-var">spills</span></a></span><span> </span><span class="annot"><span class="annottext">[RealReg]
</span><a href="#local-6989586621681032128"><span class="hs-identifier hs-var">alloc</span></a></span><span> </span><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681032127"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">[VirtualReg]
</span><a href="#local-6989586621681032126"><span class="hs-identifier hs-var">rs</span></a></span><span> </span><span class="annot"><span class="annottext">UniqFM VirtualReg Loc
</span><a href="#local-6989586621681032125"><span class="hs-identifier hs-var">assig</span></a></span><span>
</span><span id="line-781"></span><span>        </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">UniqFM VirtualReg Loc -&gt; VirtualReg -&gt; Maybe Loc
forall key elt. Uniquable key =&gt; UniqFM key elt -&gt; key -&gt; Maybe elt
</span><a href="GHC.Types.Unique.FM.html#lookupUFM"><span class="hs-identifier hs-var">lookupUFM</span></a></span><span> </span><span class="annot"><span class="annottext">UniqFM VirtualReg Loc
</span><a href="#local-6989586621681032125"><span class="hs-identifier hs-var">assig</span></a></span><span> </span><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681032127"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-782"></span><span>                </span><span class="hs-comment">-- case (1a): already in a register</span><span>
</span><span id="line-783"></span><span>                </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#InReg"><span class="hs-identifier hs-type">InReg</span></a></span><span> </span><span id="local-6989586621681032117"><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032117"><span class="hs-identifier hs-var">my_reg</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-784"></span><span>                        </span><span class="annot"><span class="annottext">Bool
-&gt; [VirtualReg]
-&gt; [instr]
-&gt; [RealReg]
-&gt; [VirtualReg]
-&gt; RegM freeRegs ([instr], [RealReg])
forall freeRegs instr.
(FR freeRegs, Outputable instr, Instruction instr) =&gt;
Bool
-&gt; [VirtualReg]
-&gt; [instr]
-&gt; [RealReg]
-&gt; [VirtualReg]
-&gt; RegM freeRegs ([instr], [RealReg])
</span><a href="GHC.CmmToAsm.Reg.Linear.html#allocateRegsAndSpill"><span class="hs-identifier hs-var">allocateRegsAndSpill</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681032131"><span class="hs-identifier hs-var">reading</span></a></span><span> </span><span class="annot"><span class="annottext">[VirtualReg]
</span><a href="#local-6989586621681032130"><span class="hs-identifier hs-var">keep</span></a></span><span> </span><span class="annot"><span class="annottext">[instr]
</span><a href="#local-6989586621681032129"><span class="hs-identifier hs-var">spills</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032117"><span class="hs-identifier hs-var">my_reg</span></a></span><span class="annot"><span class="annottext">RealReg -&gt; [RealReg] -&gt; [RealReg]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[RealReg]
</span><a href="#local-6989586621681032128"><span class="hs-identifier hs-var">alloc</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[VirtualReg]
</span><a href="#local-6989586621681032126"><span class="hs-identifier hs-var">rs</span></a></span><span>
</span><span id="line-785"></span><span>
</span><span id="line-786"></span><span>                </span><span class="hs-comment">-- case (1b): already in a register (and memory)</span><span>
</span><span id="line-787"></span><span>                </span><span class="hs-comment">-- NB1. if we're writing this register, update its assignment to be</span><span>
</span><span id="line-788"></span><span>                </span><span class="hs-comment">-- InReg, because the memory value is no longer valid.</span><span>
</span><span id="line-789"></span><span>                </span><span class="hs-comment">-- NB2. This is why we must process written registers here, even if they</span><span>
</span><span id="line-790"></span><span>                </span><span class="hs-comment">-- are also read by the same instruction.</span><span>
</span><span id="line-791"></span><span>                </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#InBoth"><span class="hs-identifier hs-type">InBoth</span></a></span><span> </span><span id="local-6989586621681032116"><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032116"><span class="hs-identifier hs-var">my_reg</span></a></span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>
</span><span id="line-792"></span><span>                 </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>  </span><span class="annot"><span class="annottext">Bool -&gt; RegM freeRegs () -&gt; RegM freeRegs ()
forall (f :: * -&gt; *). Applicative f =&gt; Bool -&gt; f () -&gt; f ()
</span><a href="../../base/src/GHC.Base.html#when"><span class="hs-identifier hs-var">when</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681032131"><span class="hs-identifier hs-var">reading</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RegMap Loc -&gt; RegM freeRegs ()
forall freeRegs. RegMap Loc -&gt; RegM freeRegs ()
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#setAssigR"><span class="hs-identifier hs-var">setAssigR</span></a></span><span> </span><span class="annot"><span class="annottext">(RegMap Loc -&gt; RegM freeRegs ()) -&gt; RegMap Loc -&gt; RegM freeRegs ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">UniqFM VirtualReg Loc -&gt; RegMap Loc
forall elt. UniqFM VirtualReg elt -&gt; UniqFM Reg elt
</span><a href="GHC.CmmToAsm.Reg.Utils.html#toRegMap"><span class="hs-identifier hs-var">toRegMap</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">UniqFM VirtualReg Loc -&gt; VirtualReg -&gt; Loc -&gt; UniqFM VirtualReg Loc
forall key elt.
Uniquable key =&gt;
UniqFM key elt -&gt; key -&gt; elt -&gt; UniqFM key elt
</span><a href="GHC.Types.Unique.FM.html#addToUFM"><span class="hs-identifier hs-var">addToUFM</span></a></span><span> </span><span class="annot"><span class="annottext">UniqFM VirtualReg Loc
</span><a href="#local-6989586621681032125"><span class="hs-identifier hs-var">assig</span></a></span><span> </span><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681032127"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RealReg -&gt; Loc
</span><a href="GHC.CmmToAsm.Reg.Linear.Base.html#InReg"><span class="hs-identifier hs-var">InReg</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032116"><span class="hs-identifier hs-var">my_reg</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-793"></span><span>                        </span><span class="annot"><span class="annottext">Bool
-&gt; [VirtualReg]
-&gt; [instr]
-&gt; [RealReg]
-&gt; [VirtualReg]
-&gt; RegM freeRegs ([instr], [RealReg])
forall freeRegs instr.
(FR freeRegs, Outputable instr, Instruction instr) =&gt;
Bool
-&gt; [VirtualReg]
-&gt; [instr]
-&gt; [RealReg]
-&gt; [VirtualReg]
-&gt; RegM freeRegs ([instr], [RealReg])
</span><a href="GHC.CmmToAsm.Reg.Linear.html#allocateRegsAndSpill"><span class="hs-identifier hs-var">allocateRegsAndSpill</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681032131"><span class="hs-identifier hs-var">reading</span></a></span><span> </span><span class="annot"><span class="annottext">[VirtualReg]
</span><a href="#local-6989586621681032130"><span class="hs-identifier hs-var">keep</span></a></span><span> </span><span class="annot"><span class="annottext">[instr]
</span><a href="#local-6989586621681032129"><span class="hs-identifier hs-var">spills</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032116"><span class="hs-identifier hs-var">my_reg</span></a></span><span class="annot"><span class="annottext">RealReg -&gt; [RealReg] -&gt; [RealReg]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[RealReg]
</span><a href="#local-6989586621681032128"><span class="hs-identifier hs-var">alloc</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[VirtualReg]
</span><a href="#local-6989586621681032126"><span class="hs-identifier hs-var">rs</span></a></span><span>
</span><span id="line-794"></span><span>
</span><span id="line-795"></span><span>                </span><span class="hs-comment">-- Not already in a register, so we need to find a free one...</span><span>
</span><span id="line-796"></span><span>                </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#InMem"><span class="hs-identifier hs-type">InMem</span></a></span><span> </span><span id="local-6989586621681032114"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681032114"><span class="hs-identifier hs-var">slot</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681032131"><span class="hs-identifier hs-var">reading</span></a></span><span>   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">SpillLoc -&gt; RegM freeRegs ([instr], [RealReg])
</span><a href="#local-6989586621681032119"><span class="hs-identifier hs-var">doSpill</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; SpillLoc
</span><a href="GHC.CmmToAsm.Reg.Linear.html#ReadMem"><span class="hs-identifier hs-var">ReadMem</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681032114"><span class="hs-identifier hs-var">slot</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-797"></span><span>                                  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">SpillLoc -&gt; RegM freeRegs ([instr], [RealReg])
</span><a href="#local-6989586621681032119"><span class="hs-identifier hs-var">doSpill</span></a></span><span> </span><span class="annot"><span class="annottext">SpillLoc
</span><a href="GHC.CmmToAsm.Reg.Linear.html#WriteMem"><span class="hs-identifier hs-var">WriteMem</span></a></span><span>
</span><span id="line-798"></span><span>                </span><span class="annot"><span class="annottext">Maybe Loc
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681032131"><span class="hs-identifier hs-var">reading</span></a></span><span>   </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-799"></span><span>                   </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; RegM freeRegs ([instr], [RealReg])
forall a. HasCallStack =&gt; String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;allocateRegsAndSpill: Cannot read from uninitialized register&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">VirtualReg -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681032127"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-800"></span><span>                   </span><span class="hs-comment">-- NOTE: if the input to the NCG contains some</span><span>
</span><span id="line-801"></span><span>                   </span><span class="hs-comment">-- unreachable blocks with junk code, this panic</span><span>
</span><span id="line-802"></span><span>                   </span><span class="hs-comment">-- might be triggered.  Make sure you only feed</span><span>
</span><span id="line-803"></span><span>                   </span><span class="hs-comment">-- sensible code into the NCG.  In GHC.Cmm.Pipeline we</span><span>
</span><span id="line-804"></span><span>                   </span><span class="hs-comment">-- call removeUnreachableBlocks at the end for this</span><span>
</span><span id="line-805"></span><span>                   </span><span class="hs-comment">-- reason.</span><span>
</span><span id="line-806"></span><span>
</span><span id="line-807"></span><span>                        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">SpillLoc -&gt; RegM freeRegs ([instr], [RealReg])
</span><a href="#local-6989586621681032119"><span class="hs-identifier hs-var">doSpill</span></a></span><span> </span><span class="annot"><span class="annottext">SpillLoc
</span><a href="GHC.CmmToAsm.Reg.Linear.html#WriteNew"><span class="hs-identifier hs-var">WriteNew</span></a></span><span>
</span><span id="line-808"></span><span>
</span><span id="line-809"></span><span class="hs-comment">-- | Given a virtual reg find a preferred real register.</span><span>
</span><span id="line-810"></span><span class="hs-comment">-- The preferred register is simply the first one the variable</span><span>
</span><span id="line-811"></span><span class="hs-comment">-- was assigned to (if any). This way when we allocate for a loop</span><span>
</span><span id="line-812"></span><span class="hs-comment">-- variables are likely to end up in the same registers at the</span><span>
</span><span id="line-813"></span><span class="hs-comment">-- end and start of the loop, avoiding redundant reg-reg moves.</span><span>
</span><span id="line-814"></span><span class="hs-comment">-- Note: I tried returning a list of past assignments, but that</span><span>
</span><span id="line-815"></span><span class="hs-comment">-- turned out to barely matter.</span><span>
</span><span id="line-816"></span><span id="local-6989586621681032720"><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.html#findPrefRealReg"><span class="hs-identifier hs-type">findPrefRealReg</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#VirtualReg"><span class="hs-identifier hs-type">VirtualReg</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.State.html#RegM"><span class="hs-identifier hs-type">RegM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032720"><span class="hs-identifier hs-type">freeRegs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#RealReg"><span class="hs-identifier hs-type">RealReg</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-817"></span><span id="findPrefRealReg"><span class="annot"><span class="annottext">findPrefRealReg :: forall freeRegs. VirtualReg -&gt; RegM freeRegs (Maybe RealReg)
</span><a href="GHC.CmmToAsm.Reg.Linear.html#findPrefRealReg"><span class="hs-identifier hs-var hs-var">findPrefRealReg</span></a></span></span><span> </span><span id="local-6989586621681032110"><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681032110"><span class="hs-identifier hs-var">vreg</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-818"></span><span>  </span><span id="local-6989586621681032109"><span class="annot"><span class="annottext">BlockAssignment freeRegs
</span><a href="#local-6989586621681032109"><span class="hs-identifier hs-var">bassig</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span id="local-6989586621681032108"><span class="annot"><span class="annottext">forall freeRegs. RegM freeRegs (BlockAssignment freeRegs)
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#getBlockAssigR"><span class="hs-identifier hs-var">getBlockAssigR</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.State.html#RegM"><span class="hs-identifier hs-type">RegM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032108"><span class="hs-identifier hs-type">freeRegs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#BlockAssignment"><span class="hs-identifier hs-type">BlockAssignment</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032108"><span class="hs-identifier hs-type">freeRegs</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-819"></span><span>  </span><span class="annot"><span class="annottext">Maybe RealReg -&gt; RegM freeRegs (Maybe RealReg)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(Maybe RealReg -&gt; RegM freeRegs (Maybe RealReg))
-&gt; Maybe RealReg -&gt; RegM freeRegs (Maybe RealReg)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">VirtualReg -&gt; BlockAssignment freeRegs -&gt; Maybe RealReg
forall freeRegs.
VirtualReg -&gt; BlockAssignment freeRegs -&gt; Maybe RealReg
</span><a href="GHC.CmmToAsm.Reg.Linear.Base.html#lookupFirstUsed"><span class="hs-identifier hs-var">lookupFirstUsed</span></a></span><span> </span><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681032110"><span class="hs-identifier hs-var">vreg</span></a></span><span> </span><span class="annot"><span class="annottext">BlockAssignment freeRegs
</span><a href="#local-6989586621681032109"><span class="hs-identifier hs-var">bassig</span></a></span><span>
</span><span id="line-820"></span><span>
</span><span id="line-821"></span><span class="hs-comment">-- reading is redundant with reason, but we keep it around because it's</span><span>
</span><span id="line-822"></span><span class="hs-comment">-- convenient and it maintains the recursive structure of the allocator. -- EZY</span><span>
</span><span id="line-823"></span><span id="local-6989586621681032722"><span id="local-6989586621681032723"><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.html#allocRegsAndSpill_spill"><span class="hs-identifier hs-type">allocRegsAndSpill_spill</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.FreeRegs.html#FR"><span class="hs-identifier hs-type">FR</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032723"><span class="hs-identifier hs-type">freeRegs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Instr.html#Instruction"><span class="hs-identifier hs-type">Instruction</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032722"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032722"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-824"></span><span>                        </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-825"></span><span>                        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Platform.Reg.html#VirtualReg"><span class="hs-identifier hs-type">VirtualReg</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-826"></span><span>                        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621681032722"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-827"></span><span>                        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Platform.Reg.html#RealReg"><span class="hs-identifier hs-type">RealReg</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-828"></span><span>                        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#VirtualReg"><span class="hs-identifier hs-type">VirtualReg</span></a></span><span>
</span><span id="line-829"></span><span>                        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Platform.Reg.html#VirtualReg"><span class="hs-identifier hs-type">VirtualReg</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-830"></span><span>                        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Unique.FM.html#UniqFM"><span class="hs-identifier hs-type">UniqFM</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#VirtualReg"><span class="hs-identifier hs-type">VirtualReg</span></a></span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#Loc"><span class="hs-identifier hs-type">Loc</span></a></span><span>
</span><span id="line-831"></span><span>                        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.html#SpillLoc"><span class="hs-identifier hs-type">SpillLoc</span></a></span><span>
</span><span id="line-832"></span><span>                        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.State.html#RegM"><span class="hs-identifier hs-type">RegM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032723"><span class="hs-identifier hs-type">freeRegs</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621681032722"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Platform.Reg.html#RealReg"><span class="hs-identifier hs-type">RealReg</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span></span></span><span>
</span><span id="line-833"></span><span id="allocRegsAndSpill_spill"><span class="annot"><span class="annottext">allocRegsAndSpill_spill :: forall freeRegs instr.
(FR freeRegs, Instruction instr, Outputable instr) =&gt;
Bool
-&gt; [VirtualReg]
-&gt; [instr]
-&gt; [RealReg]
-&gt; VirtualReg
-&gt; [VirtualReg]
-&gt; UniqFM VirtualReg Loc
-&gt; SpillLoc
-&gt; RegM freeRegs ([instr], [RealReg])
</span><a href="GHC.CmmToAsm.Reg.Linear.html#allocRegsAndSpill_spill"><span class="hs-identifier hs-var hs-var">allocRegsAndSpill_spill</span></a></span></span><span> </span><span id="local-6989586621681032086"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681032086"><span class="hs-identifier hs-var">reading</span></a></span></span><span> </span><span id="local-6989586621681032085"><span class="annot"><span class="annottext">[VirtualReg]
</span><a href="#local-6989586621681032085"><span class="hs-identifier hs-var">keep</span></a></span></span><span> </span><span id="local-6989586621681032084"><span class="annot"><span class="annottext">[instr]
</span><a href="#local-6989586621681032084"><span class="hs-identifier hs-var">spills</span></a></span></span><span> </span><span id="local-6989586621681032083"><span class="annot"><span class="annottext">[RealReg]
</span><a href="#local-6989586621681032083"><span class="hs-identifier hs-var">alloc</span></a></span></span><span> </span><span id="local-6989586621681032082"><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681032082"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span id="local-6989586621681032081"><span class="annot"><span class="annottext">[VirtualReg]
</span><a href="#local-6989586621681032081"><span class="hs-identifier hs-var">rs</span></a></span></span><span> </span><span id="local-6989586621681032080"><span class="annot"><span class="annottext">UniqFM VirtualReg Loc
</span><a href="#local-6989586621681032080"><span class="hs-identifier hs-var">assig</span></a></span></span><span> </span><span id="local-6989586621681032079"><span class="annot"><span class="annottext">SpillLoc
</span><a href="#local-6989586621681032079"><span class="hs-identifier hs-var">spill_loc</span></a></span></span><span>
</span><span id="line-834"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>   </span><span id="local-6989586621681032078"><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681032078"><span class="hs-identifier hs-var">platform</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">RegM freeRegs Platform
forall a. RegM a Platform
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#getPlatform"><span class="hs-identifier hs-var">getPlatform</span></a></span><span>
</span><span id="line-835"></span><span>        </span><span id="local-6989586621681032077"><span class="annot"><span class="annottext">freeRegs
</span><a href="#local-6989586621681032077"><span class="hs-identifier hs-var">freeRegs</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">RegM freeRegs freeRegs
forall freeRegs. RegM freeRegs freeRegs
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#getFreeRegsR"><span class="hs-identifier hs-var">getFreeRegsR</span></a></span><span>
</span><span id="line-836"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681032075"><span class="annot"><span class="annottext">freeRegs_thisClass :: [RealReg]
</span><a href="#local-6989586621681032075"><span class="hs-identifier hs-var hs-var">freeRegs_thisClass</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Platform -&gt; RegClass -&gt; freeRegs -&gt; [RealReg]
forall freeRegs.
FR freeRegs =&gt;
Platform -&gt; RegClass -&gt; freeRegs -&gt; [RealReg]
</span><a href="GHC.CmmToAsm.Reg.Linear.FreeRegs.html#frGetFreeRegs"><span class="hs-identifier hs-var">frGetFreeRegs</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681032078"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">VirtualReg -&gt; RegClass
</span><a href="GHC.Platform.Reg.html#classOfVirtualReg"><span class="hs-identifier hs-var">classOfVirtualReg</span></a></span><span> </span><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681032082"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">freeRegs
</span><a href="#local-6989586621681032077"><span class="hs-identifier hs-var">freeRegs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Platform.Reg.html#RealReg"><span class="hs-identifier hs-type">RealReg</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-837"></span><span>
</span><span id="line-838"></span><span>        </span><span class="hs-comment">-- Can we put the variable into a register it already was?</span><span>
</span><span id="line-839"></span><span>        </span><span id="local-6989586621681032073"><span class="annot"><span class="annottext">Maybe RealReg
</span><a href="#local-6989586621681032073"><span class="hs-identifier hs-var">pref_reg</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">VirtualReg -&gt; RegM freeRegs (Maybe RealReg)
forall freeRegs. VirtualReg -&gt; RegM freeRegs (Maybe RealReg)
</span><a href="GHC.CmmToAsm.Reg.Linear.html#findPrefRealReg"><span class="hs-identifier hs-var">findPrefRealReg</span></a></span><span> </span><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681032082"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-840"></span><span>
</span><span id="line-841"></span><span>        </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">[RealReg]
</span><a href="#local-6989586621681032075"><span class="hs-identifier hs-var">freeRegs_thisClass</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-842"></span><span>         </span><span class="hs-comment">-- case (2): we have a free register</span><span>
</span><span id="line-843"></span><span>         </span><span class="hs-special">(</span><span id="local-6989586621681032072"><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032072"><span class="hs-identifier hs-var">first_free</span></a></span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span class="annot"><span class="annottext">[RealReg]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-844"></span><span>           </span><span class="hs-keyword">do</span><span>   </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681032069"><span class="annot"><span class="annottext">final_reg :: RealReg
</span><a href="#local-6989586621681032069"><span class="hs-identifier hs-var hs-var">final_reg</span></a></span></span><span>
</span><span id="line-845"></span><span>                        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681032068"><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032068"><span class="hs-identifier hs-var">reg</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Maybe RealReg
</span><a href="#local-6989586621681032073"><span class="hs-identifier hs-var">pref_reg</span></a></span><span>
</span><span id="line-846"></span><span>                        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032068"><span class="hs-identifier hs-var">reg</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg -&gt; [RealReg] -&gt; Bool
forall (t :: * -&gt; *) a. (Foldable t, Eq a) =&gt; a -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#elem"><span class="hs-operator hs-var">`elem`</span></a></span><span> </span><span class="annot"><span class="annottext">[RealReg]
</span><a href="#local-6989586621681032075"><span class="hs-identifier hs-var">freeRegs_thisClass</span></a></span><span>
</span><span id="line-847"></span><span>                        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032068"><span class="hs-identifier hs-var">reg</span></a></span><span>
</span><span id="line-848"></span><span>                        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-849"></span><span>                        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032072"><span class="hs-identifier hs-var">first_free</span></a></span><span>
</span><span id="line-850"></span><span>                </span><span id="local-6989586621681032067"><span class="annot"><span class="annottext">[instr]
</span><a href="#local-6989586621681032067"><span class="hs-identifier hs-var">spills'</span></a></span></span><span>   </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">VirtualReg
-&gt; SpillLoc -&gt; RealReg -&gt; [instr] -&gt; RegM freeRegs [instr]
forall instr freeRegs.
Instruction instr =&gt;
VirtualReg
-&gt; SpillLoc -&gt; RealReg -&gt; [instr] -&gt; RegM freeRegs [instr]
</span><a href="GHC.CmmToAsm.Reg.Linear.html#loadTemp"><span class="hs-identifier hs-var">loadTemp</span></a></span><span> </span><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681032082"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">SpillLoc
</span><a href="#local-6989586621681032079"><span class="hs-identifier hs-var">spill_loc</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032069"><span class="hs-identifier hs-var">final_reg</span></a></span><span> </span><span class="annot"><span class="annottext">[instr]
</span><a href="#local-6989586621681032084"><span class="hs-identifier hs-var">spills</span></a></span><span>
</span><span id="line-851"></span><span>
</span><span id="line-852"></span><span>                </span><span class="annot"><span class="annottext">RegMap Loc -&gt; RegM freeRegs ()
forall freeRegs. RegMap Loc -&gt; RegM freeRegs ()
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#setAssigR"><span class="hs-identifier hs-var">setAssigR</span></a></span><span> </span><span class="annot"><span class="annottext">(RegMap Loc -&gt; RegM freeRegs ()) -&gt; RegMap Loc -&gt; RegM freeRegs ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">UniqFM VirtualReg Loc -&gt; RegMap Loc
forall elt. UniqFM VirtualReg elt -&gt; UniqFM Reg elt
</span><a href="GHC.CmmToAsm.Reg.Utils.html#toRegMap"><span class="hs-identifier hs-var">toRegMap</span></a></span><span>
</span><span id="line-853"></span><span>                          </span><span class="annot"><span class="annottext">(UniqFM VirtualReg Loc -&gt; RegMap Loc)
-&gt; UniqFM VirtualReg Loc -&gt; RegMap Loc
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">UniqFM VirtualReg Loc -&gt; VirtualReg -&gt; Loc -&gt; UniqFM VirtualReg Loc
forall key elt.
Uniquable key =&gt;
UniqFM key elt -&gt; key -&gt; elt -&gt; UniqFM key elt
</span><a href="GHC.Types.Unique.FM.html#addToUFM"><span class="hs-identifier hs-var">addToUFM</span></a></span><span> </span><span class="annot"><span class="annottext">UniqFM VirtualReg Loc
</span><a href="#local-6989586621681032080"><span class="hs-identifier hs-var">assig</span></a></span><span> </span><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681032082"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">(Loc -&gt; UniqFM VirtualReg Loc) -&gt; Loc -&gt; UniqFM VirtualReg Loc
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="annot"><span class="annottext">SpillLoc -&gt; RealReg -&gt; Loc
</span><a href="GHC.CmmToAsm.Reg.Linear.html#newLocation"><span class="hs-identifier hs-var">newLocation</span></a></span><span> </span><span class="annot"><span class="annottext">SpillLoc
</span><a href="#local-6989586621681032079"><span class="hs-identifier hs-var">spill_loc</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032069"><span class="hs-identifier hs-var">final_reg</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-854"></span><span>                </span><span class="annot"><span class="annottext">freeRegs -&gt; RegM freeRegs ()
forall freeRegs. freeRegs -&gt; RegM freeRegs ()
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#setFreeRegsR"><span class="hs-identifier hs-var">setFreeRegsR</span></a></span><span> </span><span class="annot"><span class="annottext">(freeRegs -&gt; RegM freeRegs ()) -&gt; freeRegs -&gt; RegM freeRegs ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>  </span><span class="annot"><span class="annottext">Platform -&gt; RealReg -&gt; freeRegs -&gt; freeRegs
forall freeRegs.
FR freeRegs =&gt;
Platform -&gt; RealReg -&gt; freeRegs -&gt; freeRegs
</span><a href="GHC.CmmToAsm.Reg.Linear.FreeRegs.html#frAllocateReg"><span class="hs-identifier hs-var">frAllocateReg</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681032078"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032069"><span class="hs-identifier hs-var">final_reg</span></a></span><span> </span><span class="annot"><span class="annottext">freeRegs
</span><a href="#local-6989586621681032077"><span class="hs-identifier hs-var">freeRegs</span></a></span><span>
</span><span id="line-855"></span><span>
</span><span id="line-856"></span><span>                </span><span class="annot"><span class="annottext">Bool
-&gt; [VirtualReg]
-&gt; [instr]
-&gt; [RealReg]
-&gt; [VirtualReg]
-&gt; RegM freeRegs ([instr], [RealReg])
forall freeRegs instr.
(FR freeRegs, Outputable instr, Instruction instr) =&gt;
Bool
-&gt; [VirtualReg]
-&gt; [instr]
-&gt; [RealReg]
-&gt; [VirtualReg]
-&gt; RegM freeRegs ([instr], [RealReg])
</span><a href="GHC.CmmToAsm.Reg.Linear.html#allocateRegsAndSpill"><span class="hs-identifier hs-var">allocateRegsAndSpill</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681032086"><span class="hs-identifier hs-var">reading</span></a></span><span> </span><span class="annot"><span class="annottext">[VirtualReg]
</span><a href="#local-6989586621681032085"><span class="hs-identifier hs-var">keep</span></a></span><span> </span><span class="annot"><span class="annottext">[instr]
</span><a href="#local-6989586621681032067"><span class="hs-identifier hs-var">spills'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032069"><span class="hs-identifier hs-var">final_reg</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg -&gt; [RealReg] -&gt; [RealReg]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[RealReg]
</span><a href="#local-6989586621681032083"><span class="hs-identifier hs-var">alloc</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[VirtualReg]
</span><a href="#local-6989586621681032081"><span class="hs-identifier hs-var">rs</span></a></span><span>
</span><span id="line-857"></span><span>
</span><span id="line-858"></span><span>
</span><span id="line-859"></span><span>          </span><span class="hs-comment">-- case (3): we need to push something out to free up a register</span><span>
</span><span id="line-860"></span><span>         </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-861"></span><span>           </span><span class="hs-keyword">do</span><span>   </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681032064"><span class="annot"><span class="annottext">inRegOrBoth :: Loc -&gt; Bool
</span><a href="#local-6989586621681032064"><span class="hs-identifier hs-var hs-var">inRegOrBoth</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#InReg"><span class="hs-identifier hs-type">InReg</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-862"></span><span>                    </span><span class="annot"><a href="#local-6989586621681032064"><span class="hs-identifier hs-var">inRegOrBoth</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#InBoth"><span class="hs-identifier hs-type">InBoth</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-863"></span><span>                    </span><span class="annot"><a href="#local-6989586621681032064"><span class="hs-identifier hs-var">inRegOrBoth</span></a></span><span> </span><span class="annot"><span class="annottext">Loc
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-864"></span><span>                </span><span class="hs-keyword">let</span><span> </span><span class="annot"><a href="#local-6989586621681032063"><span class="hs-identifier hs-type">candidates'</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Unique.FM.html#UniqFM"><span class="hs-identifier hs-type">UniqFM</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#VirtualReg"><span class="hs-identifier hs-type">VirtualReg</span></a></span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#Loc"><span class="hs-identifier hs-type">Loc</span></a></span><span>
</span><span id="line-865"></span><span>                    </span><span id="local-6989586621681032063"><span class="annot"><span class="annottext">candidates' :: UniqFM VirtualReg Loc
</span><a href="#local-6989586621681032063"><span class="hs-identifier hs-var hs-var">candidates'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-866"></span><span>                      </span><span class="annot"><span class="annottext">(UniqFM VirtualReg Loc -&gt; [VirtualReg] -&gt; UniqFM VirtualReg Loc)
-&gt; [VirtualReg] -&gt; UniqFM VirtualReg Loc -&gt; UniqFM VirtualReg Loc
forall a b c. (a -&gt; b -&gt; c) -&gt; b -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#flip"><span class="hs-identifier hs-var">flip</span></a></span><span> </span><span class="annot"><span class="annottext">UniqFM VirtualReg Loc -&gt; [VirtualReg] -&gt; UniqFM VirtualReg Loc
forall key elt.
Uniquable key =&gt;
UniqFM key elt -&gt; [key] -&gt; UniqFM key elt
</span><a href="GHC.Types.Unique.FM.html#delListFromUFM"><span class="hs-identifier hs-var">delListFromUFM</span></a></span><span> </span><span class="annot"><span class="annottext">[VirtualReg]
</span><a href="#local-6989586621681032085"><span class="hs-identifier hs-var">keep</span></a></span><span> </span><span class="annot"><span class="annottext">(UniqFM VirtualReg Loc -&gt; UniqFM VirtualReg Loc)
-&gt; UniqFM VirtualReg Loc -&gt; UniqFM VirtualReg Loc
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-867"></span><span>                      </span><span class="annot"><span class="annottext">(Loc -&gt; Bool) -&gt; UniqFM VirtualReg Loc -&gt; UniqFM VirtualReg Loc
forall elt key. (elt -&gt; Bool) -&gt; UniqFM key elt -&gt; UniqFM key elt
</span><a href="GHC.Types.Unique.FM.html#filterUFM"><span class="hs-identifier hs-var">filterUFM</span></a></span><span> </span><span class="annot"><span class="annottext">Loc -&gt; Bool
</span><a href="#local-6989586621681032064"><span class="hs-identifier hs-var">inRegOrBoth</span></a></span><span> </span><span class="annot"><span class="annottext">(UniqFM VirtualReg Loc -&gt; UniqFM VirtualReg Loc)
-&gt; UniqFM VirtualReg Loc -&gt; UniqFM VirtualReg Loc
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-868"></span><span>                      </span><span class="annot"><span class="annottext">UniqFM VirtualReg Loc
</span><a href="#local-6989586621681032080"><span class="hs-identifier hs-var">assig</span></a></span><span>
</span><span id="line-869"></span><span>                      </span><span class="hs-comment">-- This is non-deterministic but we do not</span><span>
</span><span id="line-870"></span><span>                      </span><span class="hs-comment">-- currently support deterministic code-generation.</span><span>
</span><span id="line-871"></span><span>                      </span><span class="hs-comment">-- See Note [Unique Determinism and code generation]</span><span>
</span><span id="line-872"></span><span>                </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681032060"><span class="annot"><span class="annottext">candidates :: [(Unique, Loc)]
</span><a href="#local-6989586621681032060"><span class="hs-identifier hs-var hs-var">candidates</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UniqFM VirtualReg Loc -&gt; [(Unique, Loc)]
forall key elt. UniqFM key elt -&gt; [(Unique, elt)]
</span><a href="GHC.Types.Unique.FM.html#nonDetUFMToList"><span class="hs-identifier hs-var">nonDetUFMToList</span></a></span><span> </span><span class="annot"><span class="annottext">UniqFM VirtualReg Loc
</span><a href="#local-6989586621681032063"><span class="hs-identifier hs-var">candidates'</span></a></span><span>
</span><span id="line-873"></span><span>
</span><span id="line-874"></span><span>                </span><span class="hs-comment">-- the vregs we could kick out that are already in a slot</span><span>
</span><span id="line-875"></span><span>                </span><span class="hs-keyword">let</span><span> </span><span class="annot"><a href="#local-6989586621681032059"><span class="hs-identifier hs-type">candidates_inBoth</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Unique.html#Unique"><span class="hs-identifier hs-type">Unique</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#RealReg"><span class="hs-identifier hs-type">RealReg</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.StackMap.html#StackSlot"><span class="hs-identifier hs-type">StackSlot</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-876"></span><span>                    </span><span id="local-6989586621681032059"><span class="annot"><span class="annottext">candidates_inBoth :: [(Unique, RealReg, Int)]
</span><a href="#local-6989586621681032059"><span class="hs-identifier hs-var hs-var">candidates_inBoth</span></a></span></span><span>
</span><span id="line-877"></span><span>                        </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Unique
</span><a href="#local-6989586621681032058"><span class="hs-identifier hs-var">temp</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032057"><span class="hs-identifier hs-var">reg</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681032056"><span class="hs-identifier hs-var">mem</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-878"></span><span>                          </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681032058"><span class="annot"><span class="annottext">Unique
</span><a href="#local-6989586621681032058"><span class="hs-identifier hs-var">temp</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#InBoth"><span class="hs-identifier hs-type">InBoth</span></a></span><span> </span><span id="local-6989586621681032057"><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032057"><span class="hs-identifier hs-var">reg</span></a></span></span><span> </span><span id="local-6989586621681032056"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681032056"><span class="hs-identifier hs-var">mem</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[(Unique, Loc)]
</span><a href="#local-6989586621681032060"><span class="hs-identifier hs-var">candidates</span></a></span><span>
</span><span id="line-879"></span><span>                          </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Platform -&gt; RealReg -&gt; RegClass
</span><a href="GHC.CmmToAsm.Reg.Target.html#targetClassOfRealReg"><span class="hs-identifier hs-var">targetClassOfRealReg</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681032078"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032057"><span class="hs-identifier hs-var">reg</span></a></span><span> </span><span class="annot"><span class="annottext">RegClass -&gt; RegClass -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">VirtualReg -&gt; RegClass
</span><a href="GHC.Platform.Reg.html#classOfVirtualReg"><span class="hs-identifier hs-var">classOfVirtualReg</span></a></span><span> </span><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681032082"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-880"></span><span>
</span><span id="line-881"></span><span>                </span><span class="hs-comment">-- the vregs we could kick out that are only in a reg</span><span>
</span><span id="line-882"></span><span>                </span><span class="hs-comment">--      this would require writing the reg to a new slot before using it.</span><span>
</span><span id="line-883"></span><span>                </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681032054"><span class="annot"><span class="annottext">candidates_inReg :: [(Unique, RealReg)]
</span><a href="#local-6989586621681032054"><span class="hs-identifier hs-var hs-var">candidates_inReg</span></a></span></span><span>
</span><span id="line-884"></span><span>                        </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Unique
</span><a href="#local-6989586621681032053"><span class="hs-identifier hs-var">temp</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032052"><span class="hs-identifier hs-var">reg</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-885"></span><span>                          </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681032053"><span class="annot"><span class="annottext">Unique
</span><a href="#local-6989586621681032053"><span class="hs-identifier hs-var">temp</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#InReg"><span class="hs-identifier hs-type">InReg</span></a></span><span> </span><span id="local-6989586621681032052"><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032052"><span class="hs-identifier hs-var">reg</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[(Unique, Loc)]
</span><a href="#local-6989586621681032060"><span class="hs-identifier hs-var">candidates</span></a></span><span>
</span><span id="line-886"></span><span>                          </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Platform -&gt; RealReg -&gt; RegClass
</span><a href="GHC.CmmToAsm.Reg.Target.html#targetClassOfRealReg"><span class="hs-identifier hs-var">targetClassOfRealReg</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681032078"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032052"><span class="hs-identifier hs-var">reg</span></a></span><span> </span><span class="annot"><span class="annottext">RegClass -&gt; RegClass -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">VirtualReg -&gt; RegClass
</span><a href="GHC.Platform.Reg.html#classOfVirtualReg"><span class="hs-identifier hs-var">classOfVirtualReg</span></a></span><span> </span><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681032082"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-887"></span><span>
</span><span id="line-888"></span><span>                </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681032025"><span class="annot"><span class="annottext">result :: RegM freeRegs ([instr], [RealReg])
</span><a href="#local-6989586621681032025"><span class="hs-identifier hs-var hs-var">result</span></a></span></span><span>
</span><span id="line-889"></span><span>
</span><span id="line-890"></span><span>                        </span><span class="hs-comment">-- we have a temporary that is in both register and mem,</span><span>
</span><span id="line-891"></span><span>                        </span><span class="hs-comment">-- just free up its register for use.</span><span>
</span><span id="line-892"></span><span>                        </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681032024"><span class="annot"><span class="annottext">Unique
</span><a href="#local-6989586621681032024"><span class="hs-identifier hs-var">temp</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681032023"><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032023"><span class="hs-identifier hs-var">my_reg</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681032022"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681032022"><span class="hs-identifier hs-var">slot</span></a></span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span class="annot"><span class="annottext">[(Unique, RealReg, Int)]
</span><span class="hs-identifier">_</span></span><span>      </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[(Unique, RealReg, Int)]
</span><a href="#local-6989586621681032059"><span class="hs-identifier hs-var">candidates_inBoth</span></a></span><span>
</span><span id="line-893"></span><span>                        </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>    </span><span id="local-6989586621681032021"><span class="annot"><span class="annottext">[instr]
</span><a href="#local-6989586621681032021"><span class="hs-identifier hs-var">spills'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">VirtualReg
-&gt; SpillLoc -&gt; RealReg -&gt; [instr] -&gt; RegM freeRegs [instr]
forall instr freeRegs.
Instruction instr =&gt;
VirtualReg
-&gt; SpillLoc -&gt; RealReg -&gt; [instr] -&gt; RegM freeRegs [instr]
</span><a href="GHC.CmmToAsm.Reg.Linear.html#loadTemp"><span class="hs-identifier hs-var">loadTemp</span></a></span><span> </span><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681032082"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">SpillLoc
</span><a href="#local-6989586621681032079"><span class="hs-identifier hs-var">spill_loc</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032023"><span class="hs-identifier hs-var">my_reg</span></a></span><span> </span><span class="annot"><span class="annottext">[instr]
</span><a href="#local-6989586621681032084"><span class="hs-identifier hs-var">spills</span></a></span><span>
</span><span id="line-894"></span><span>                                </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681032020"><span class="annot"><span class="annottext">assig1 :: UniqFM VirtualReg Loc
</span><a href="#local-6989586621681032020"><span class="hs-identifier hs-var hs-var">assig1</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UniqFM VirtualReg Loc -&gt; Unique -&gt; Loc -&gt; UniqFM VirtualReg Loc
forall key elt. UniqFM key elt -&gt; Unique -&gt; elt -&gt; UniqFM key elt
</span><a href="GHC.Types.Unique.FM.html#addToUFM_Directly"><span class="hs-identifier hs-var">addToUFM_Directly</span></a></span><span> </span><span class="annot"><span class="annottext">UniqFM VirtualReg Loc
</span><a href="#local-6989586621681032080"><span class="hs-identifier hs-var">assig</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="#local-6989586621681032024"><span class="hs-identifier hs-var">temp</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Loc
</span><a href="GHC.CmmToAsm.Reg.Linear.Base.html#InMem"><span class="hs-identifier hs-var">InMem</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681032022"><span class="hs-identifier hs-var">slot</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-895"></span><span>                                </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681032018"><span class="annot"><span class="annottext">assig2 :: UniqFM VirtualReg Loc
</span><a href="#local-6989586621681032018"><span class="hs-identifier hs-var hs-var">assig2</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UniqFM VirtualReg Loc -&gt; VirtualReg -&gt; Loc -&gt; UniqFM VirtualReg Loc
forall key elt.
Uniquable key =&gt;
UniqFM key elt -&gt; key -&gt; elt -&gt; UniqFM key elt
</span><a href="GHC.Types.Unique.FM.html#addToUFM"><span class="hs-identifier hs-var">addToUFM</span></a></span><span> </span><span class="annot"><span class="annottext">UniqFM VirtualReg Loc
</span><a href="#local-6989586621681032020"><span class="hs-identifier hs-var">assig1</span></a></span><span> </span><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681032082"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">(Loc -&gt; UniqFM VirtualReg Loc) -&gt; Loc -&gt; UniqFM VirtualReg Loc
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="annot"><span class="annottext">SpillLoc -&gt; RealReg -&gt; Loc
</span><a href="GHC.CmmToAsm.Reg.Linear.html#newLocation"><span class="hs-identifier hs-var">newLocation</span></a></span><span> </span><span class="annot"><span class="annottext">SpillLoc
</span><a href="#local-6989586621681032079"><span class="hs-identifier hs-var">spill_loc</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032023"><span class="hs-identifier hs-var">my_reg</span></a></span><span>
</span><span id="line-896"></span><span>
</span><span id="line-897"></span><span>                                </span><span class="annot"><span class="annottext">RegMap Loc -&gt; RegM freeRegs ()
forall freeRegs. RegMap Loc -&gt; RegM freeRegs ()
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#setAssigR"><span class="hs-identifier hs-var">setAssigR</span></a></span><span> </span><span class="annot"><span class="annottext">(RegMap Loc -&gt; RegM freeRegs ()) -&gt; RegMap Loc -&gt; RegM freeRegs ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">UniqFM VirtualReg Loc -&gt; RegMap Loc
forall elt. UniqFM VirtualReg elt -&gt; UniqFM Reg elt
</span><a href="GHC.CmmToAsm.Reg.Utils.html#toRegMap"><span class="hs-identifier hs-var">toRegMap</span></a></span><span> </span><span class="annot"><span class="annottext">UniqFM VirtualReg Loc
</span><a href="#local-6989586621681032018"><span class="hs-identifier hs-var">assig2</span></a></span><span>
</span><span id="line-898"></span><span>                                </span><span class="annot"><span class="annottext">Bool
-&gt; [VirtualReg]
-&gt; [instr]
-&gt; [RealReg]
-&gt; [VirtualReg]
-&gt; RegM freeRegs ([instr], [RealReg])
forall freeRegs instr.
(FR freeRegs, Outputable instr, Instruction instr) =&gt;
Bool
-&gt; [VirtualReg]
-&gt; [instr]
-&gt; [RealReg]
-&gt; [VirtualReg]
-&gt; RegM freeRegs ([instr], [RealReg])
</span><a href="GHC.CmmToAsm.Reg.Linear.html#allocateRegsAndSpill"><span class="hs-identifier hs-var">allocateRegsAndSpill</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681032086"><span class="hs-identifier hs-var">reading</span></a></span><span> </span><span class="annot"><span class="annottext">[VirtualReg]
</span><a href="#local-6989586621681032085"><span class="hs-identifier hs-var">keep</span></a></span><span> </span><span class="annot"><span class="annottext">[instr]
</span><a href="#local-6989586621681032021"><span class="hs-identifier hs-var">spills'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032023"><span class="hs-identifier hs-var">my_reg</span></a></span><span class="annot"><span class="annottext">RealReg -&gt; [RealReg] -&gt; [RealReg]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[RealReg]
</span><a href="#local-6989586621681032083"><span class="hs-identifier hs-var">alloc</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[VirtualReg]
</span><a href="#local-6989586621681032081"><span class="hs-identifier hs-var">rs</span></a></span><span>
</span><span id="line-899"></span><span>
</span><span id="line-900"></span><span>                        </span><span class="hs-comment">-- otherwise, we need to spill a temporary that currently</span><span>
</span><span id="line-901"></span><span>                        </span><span class="hs-comment">-- resides in a register.</span><span>
</span><span id="line-902"></span><span>                        </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681032017"><span class="annot"><span class="annottext">Unique
</span><a href="#local-6989586621681032017"><span class="hs-identifier hs-var">temp_to_push_out</span></a></span></span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681032016"><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032016"><span class="hs-identifier hs-var">my_reg</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#RealReg"><span class="hs-identifier hs-type">RealReg</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span class="annot"><span class="annottext">[(Unique, RealReg)]
</span><span class="hs-identifier">_</span></span><span>
</span><span id="line-903"></span><span>                                        </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[(Unique, RealReg)]
</span><a href="#local-6989586621681032054"><span class="hs-identifier hs-var">candidates_inReg</span></a></span><span>
</span><span id="line-904"></span><span>                        </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-905"></span><span>                                </span><span class="hs-special">(</span><span id="local-6989586621681032015"><span class="annot"><span class="annottext">instr
</span><a href="#local-6989586621681032015"><span class="hs-identifier hs-var">spill_insn</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681032014"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681032014"><span class="hs-identifier hs-var">slot</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Reg -&gt; Unique -&gt; RegM freeRegs (instr, Int)
forall instr freeRegs.
Instruction instr =&gt;
Reg -&gt; Unique -&gt; RegM freeRegs (instr, Int)
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#spillR"><span class="hs-identifier hs-var">spillR</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RealReg -&gt; Reg
</span><a href="GHC.Platform.Reg.html#RegReal"><span class="hs-identifier hs-var">RegReal</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032016"><span class="hs-identifier hs-var">my_reg</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="#local-6989586621681032017"><span class="hs-identifier hs-var">temp_to_push_out</span></a></span><span>
</span><span id="line-906"></span><span>                                </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681032013"><span class="annot"><span class="annottext">spill_store :: [instr]
</span><a href="#local-6989586621681032013"><span class="hs-identifier hs-var hs-var">spill_store</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681032086"><span class="hs-identifier hs-var">reading</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">[instr] -&gt; [instr]
forall a. a -&gt; a
</span><a href="../../base/src/GHC.Base.html#id"><span class="hs-identifier hs-var">id</span></a></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">[instr] -&gt; [instr]
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-907"></span><span>                                                        </span><span class="hs-special">[</span><span> </span><span class="hs-comment">-- COMMENT (fsLit &quot;spill alloc&quot;)</span><span>
</span><span id="line-908"></span><span>                                                           </span><span class="annot"><span class="annottext">instr
</span><a href="#local-6989586621681032015"><span class="hs-identifier hs-var">spill_insn</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-909"></span><span>
</span><span id="line-910"></span><span>                                </span><span class="hs-comment">-- record that this temp was spilled</span><span>
</span><span id="line-911"></span><span>                                </span><span class="annot"><span class="annottext">SpillReason -&gt; RegM freeRegs ()
forall freeRegs. SpillReason -&gt; RegM freeRegs ()
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#recordSpill"><span class="hs-identifier hs-var">recordSpill</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Unique -&gt; SpillReason
</span><a href="GHC.CmmToAsm.Reg.Linear.Base.html#SpillAlloc"><span class="hs-identifier hs-var">SpillAlloc</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="#local-6989586621681032017"><span class="hs-identifier hs-var">temp_to_push_out</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-912"></span><span>
</span><span id="line-913"></span><span>                                </span><span class="hs-comment">-- update the register assignment</span><span>
</span><span id="line-914"></span><span>                                </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681032010"><span class="annot"><span class="annottext">assig1 :: UniqFM VirtualReg Loc
</span><a href="#local-6989586621681032010"><span class="hs-identifier hs-var hs-var">assig1</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UniqFM VirtualReg Loc -&gt; Unique -&gt; Loc -&gt; UniqFM VirtualReg Loc
forall key elt. UniqFM key elt -&gt; Unique -&gt; elt -&gt; UniqFM key elt
</span><a href="GHC.Types.Unique.FM.html#addToUFM_Directly"><span class="hs-identifier hs-var">addToUFM_Directly</span></a></span><span> </span><span class="annot"><span class="annottext">UniqFM VirtualReg Loc
</span><a href="#local-6989586621681032080"><span class="hs-identifier hs-var">assig</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="#local-6989586621681032017"><span class="hs-identifier hs-var">temp_to_push_out</span></a></span><span>   </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Loc
</span><a href="GHC.CmmToAsm.Reg.Linear.Base.html#InMem"><span class="hs-identifier hs-var">InMem</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681032014"><span class="hs-identifier hs-var">slot</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-915"></span><span>                                </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681032008"><span class="annot"><span class="annottext">assig2 :: UniqFM VirtualReg Loc
</span><a href="#local-6989586621681032008"><span class="hs-identifier hs-var hs-var">assig2</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UniqFM VirtualReg Loc -&gt; VirtualReg -&gt; Loc -&gt; UniqFM VirtualReg Loc
forall key elt.
Uniquable key =&gt;
UniqFM key elt -&gt; key -&gt; elt -&gt; UniqFM key elt
</span><a href="GHC.Types.Unique.FM.html#addToUFM"><span class="hs-identifier hs-var">addToUFM</span></a></span><span> </span><span class="annot"><span class="annottext">UniqFM VirtualReg Loc
</span><a href="#local-6989586621681032010"><span class="hs-identifier hs-var">assig1</span></a></span><span> </span><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681032082"><span class="hs-identifier hs-var">r</span></a></span><span>                 </span><span class="annot"><span class="annottext">(Loc -&gt; UniqFM VirtualReg Loc) -&gt; Loc -&gt; UniqFM VirtualReg Loc
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="annot"><span class="annottext">SpillLoc -&gt; RealReg -&gt; Loc
</span><a href="GHC.CmmToAsm.Reg.Linear.html#newLocation"><span class="hs-identifier hs-var">newLocation</span></a></span><span> </span><span class="annot"><span class="annottext">SpillLoc
</span><a href="#local-6989586621681032079"><span class="hs-identifier hs-var">spill_loc</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032016"><span class="hs-identifier hs-var">my_reg</span></a></span><span>
</span><span id="line-916"></span><span>                                </span><span class="annot"><span class="annottext">RegMap Loc -&gt; RegM freeRegs ()
forall freeRegs. RegMap Loc -&gt; RegM freeRegs ()
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#setAssigR"><span class="hs-identifier hs-var">setAssigR</span></a></span><span> </span><span class="annot"><span class="annottext">(RegMap Loc -&gt; RegM freeRegs ()) -&gt; RegMap Loc -&gt; RegM freeRegs ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">UniqFM VirtualReg Loc -&gt; RegMap Loc
forall elt. UniqFM VirtualReg elt -&gt; UniqFM Reg elt
</span><a href="GHC.CmmToAsm.Reg.Utils.html#toRegMap"><span class="hs-identifier hs-var">toRegMap</span></a></span><span> </span><span class="annot"><span class="annottext">UniqFM VirtualReg Loc
</span><a href="#local-6989586621681032008"><span class="hs-identifier hs-var">assig2</span></a></span><span>
</span><span id="line-917"></span><span>
</span><span id="line-918"></span><span>                                </span><span class="hs-comment">-- if need be, load up a spilled temp into the reg we've just freed up.</span><span>
</span><span id="line-919"></span><span>                                </span><span id="local-6989586621681032007"><span class="annot"><span class="annottext">[instr]
</span><a href="#local-6989586621681032007"><span class="hs-identifier hs-var">spills'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">VirtualReg
-&gt; SpillLoc -&gt; RealReg -&gt; [instr] -&gt; RegM freeRegs [instr]
forall instr freeRegs.
Instruction instr =&gt;
VirtualReg
-&gt; SpillLoc -&gt; RealReg -&gt; [instr] -&gt; RegM freeRegs [instr]
</span><a href="GHC.CmmToAsm.Reg.Linear.html#loadTemp"><span class="hs-identifier hs-var">loadTemp</span></a></span><span> </span><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681032082"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">SpillLoc
</span><a href="#local-6989586621681032079"><span class="hs-identifier hs-var">spill_loc</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032016"><span class="hs-identifier hs-var">my_reg</span></a></span><span> </span><span class="annot"><span class="annottext">[instr]
</span><a href="#local-6989586621681032084"><span class="hs-identifier hs-var">spills</span></a></span><span>
</span><span id="line-920"></span><span>
</span><span id="line-921"></span><span>                                </span><span class="annot"><span class="annottext">Bool
-&gt; [VirtualReg]
-&gt; [instr]
-&gt; [RealReg]
-&gt; [VirtualReg]
-&gt; RegM freeRegs ([instr], [RealReg])
forall freeRegs instr.
(FR freeRegs, Outputable instr, Instruction instr) =&gt;
Bool
-&gt; [VirtualReg]
-&gt; [instr]
-&gt; [RealReg]
-&gt; [VirtualReg]
-&gt; RegM freeRegs ([instr], [RealReg])
</span><a href="GHC.CmmToAsm.Reg.Linear.html#allocateRegsAndSpill"><span class="hs-identifier hs-var">allocateRegsAndSpill</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681032086"><span class="hs-identifier hs-var">reading</span></a></span><span> </span><span class="annot"><span class="annottext">[VirtualReg]
</span><a href="#local-6989586621681032085"><span class="hs-identifier hs-var">keep</span></a></span><span>
</span><span id="line-922"></span><span>                                        </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[instr]
</span><a href="#local-6989586621681032013"><span class="hs-identifier hs-var">spill_store</span></a></span><span> </span><span class="annot"><span class="annottext">[instr] -&gt; [instr] -&gt; [instr]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[instr]
</span><a href="#local-6989586621681032007"><span class="hs-identifier hs-var">spills'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-923"></span><span>                                        </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032016"><span class="hs-identifier hs-var">my_reg</span></a></span><span class="annot"><span class="annottext">RealReg -&gt; [RealReg] -&gt; [RealReg]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[RealReg]
</span><a href="#local-6989586621681032083"><span class="hs-identifier hs-var">alloc</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[VirtualReg]
</span><a href="#local-6989586621681032081"><span class="hs-identifier hs-var">rs</span></a></span><span>
</span><span id="line-924"></span><span>
</span><span id="line-925"></span><span>
</span><span id="line-926"></span><span>                        </span><span class="hs-comment">-- there wasn't anything to spill, so we're screwed.</span><span>
</span><span id="line-927"></span><span>                        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-928"></span><span>                        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; RegM freeRegs ([instr], [RealReg])
forall a. HasCallStack =&gt; String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;RegAllocLinear.allocRegsAndSpill: no spill candidates\n&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-929"></span><span>                        </span><span class="annot"><span class="annottext">(SDoc -&gt; RegM freeRegs ([instr], [RealReg]))
-&gt; SDoc -&gt; RegM freeRegs ([instr], [RealReg])
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span>
</span><span id="line-930"></span><span>                                </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;allocating vreg:  &quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">VirtualReg -&gt; String
forall a. Show a =&gt; a -&gt; String
</span><a href="../../base/src/GHC.Show.html#show"><span class="hs-identifier hs-var">show</span></a></span><span> </span><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681032082"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-931"></span><span>                                </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;assignment:       &quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">UniqFM VirtualReg Loc -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">UniqFM VirtualReg Loc
</span><a href="#local-6989586621681032080"><span class="hs-identifier hs-var">assig</span></a></span><span>
</span><span id="line-932"></span><span>                                </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;freeRegs:         &quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">freeRegs -&gt; String
forall a. Show a =&gt; a -&gt; String
</span><a href="../../base/src/GHC.Show.html#show"><span class="hs-identifier hs-var">show</span></a></span><span> </span><span class="annot"><span class="annottext">freeRegs
</span><a href="#local-6989586621681032077"><span class="hs-identifier hs-var">freeRegs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-933"></span><span>                                </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;initFreeRegs:     &quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">freeRegs -&gt; String
forall a. Show a =&gt; a -&gt; String
</span><a href="../../base/src/GHC.Show.html#show"><span class="hs-identifier hs-var">show</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform -&gt; freeRegs
forall freeRegs. FR freeRegs =&gt; Platform -&gt; freeRegs
</span><a href="GHC.CmmToAsm.Reg.Linear.FreeRegs.html#frInitFreeRegs"><span class="hs-identifier hs-var">frInitFreeRegs</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681032078"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="annot"><span class="annottext">freeRegs -&gt; freeRegs -&gt; freeRegs
forall a. a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Base.html#asTypeOf"><span class="hs-operator hs-var">`asTypeOf`</span></a></span><span> </span><span class="annot"><span class="annottext">freeRegs
</span><a href="#local-6989586621681032077"><span class="hs-identifier hs-var">freeRegs</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-934"></span><span>
</span><span id="line-935"></span><span>                </span><span class="annot"><span class="annottext">RegM freeRegs ([instr], [RealReg])
</span><a href="#local-6989586621681032025"><span class="hs-identifier hs-var">result</span></a></span><span>
</span><span id="line-936"></span><span>
</span><span id="line-937"></span><span>
</span><span id="line-938"></span><span class="hs-comment">-- | Calculate a new location after a register has been loaded.</span><span>
</span><span id="line-939"></span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.html#newLocation"><span class="hs-identifier hs-type">newLocation</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.html#SpillLoc"><span class="hs-identifier hs-type">SpillLoc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#RealReg"><span class="hs-identifier hs-type">RealReg</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#Loc"><span class="hs-identifier hs-type">Loc</span></a></span><span>
</span><span id="line-940"></span><span class="hs-comment">-- if the tmp was read from a slot, then now its in a reg as well</span><span>
</span><span id="line-941"></span><span id="newLocation"><span class="annot"><span class="annottext">newLocation :: SpillLoc -&gt; RealReg -&gt; Loc
</span><a href="GHC.CmmToAsm.Reg.Linear.html#newLocation"><span class="hs-identifier hs-var hs-var">newLocation</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.html#ReadMem"><span class="hs-identifier hs-type">ReadMem</span></a></span><span> </span><span id="local-6989586621681032003"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681032003"><span class="hs-identifier hs-var">slot</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681032002"><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032002"><span class="hs-identifier hs-var">my_reg</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RealReg -&gt; Int -&gt; Loc
</span><a href="GHC.CmmToAsm.Reg.Linear.Base.html#InBoth"><span class="hs-identifier hs-var">InBoth</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032002"><span class="hs-identifier hs-var">my_reg</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681032003"><span class="hs-identifier hs-var">slot</span></a></span><span>
</span><span id="line-942"></span><span class="hs-comment">-- writes will always result in only the register being available</span><span>
</span><span id="line-943"></span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.html#newLocation"><span class="hs-identifier hs-var">newLocation</span></a></span><span> </span><span class="annot"><span class="annottext">SpillLoc
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681032001"><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032001"><span class="hs-identifier hs-var">my_reg</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RealReg -&gt; Loc
</span><a href="GHC.CmmToAsm.Reg.Linear.Base.html#InReg"><span class="hs-identifier hs-var">InReg</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681032001"><span class="hs-identifier hs-var">my_reg</span></a></span><span>
</span><span id="line-944"></span><span>
</span><span id="line-945"></span><span class="hs-comment">-- | Load up a spilled temporary if we need to (read from memory).</span><span>
</span><span id="line-946"></span><span id="local-6989586621681032714"><span id="local-6989586621681032715"><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.html#loadTemp"><span class="hs-identifier hs-type">loadTemp</span></a></span><span>
</span><span id="line-947"></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToAsm.Instr.html#Instruction"><span class="hs-identifier hs-type">Instruction</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032715"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-948"></span><span>        </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#VirtualReg"><span class="hs-identifier hs-type">VirtualReg</span></a></span><span>   </span><span class="hs-comment">-- the temp being loaded</span><span>
</span><span id="line-949"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.html#SpillLoc"><span class="hs-identifier hs-type">SpillLoc</span></a></span><span>     </span><span class="hs-comment">-- the current location of this temp</span><span>
</span><span id="line-950"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#RealReg"><span class="hs-identifier hs-type">RealReg</span></a></span><span>      </span><span class="hs-comment">-- the hreg to load the temp into</span><span>
</span><span id="line-951"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621681032715"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-952"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.State.html#RegM"><span class="hs-identifier hs-type">RegM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681032714"><span class="hs-identifier hs-type">freeRegs</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621681032715"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">]</span></span></span><span>
</span><span id="line-953"></span><span>
</span><span id="line-954"></span><span id="loadTemp"><span class="annot"><span class="annottext">loadTemp :: forall instr freeRegs.
Instruction instr =&gt;
VirtualReg
-&gt; SpillLoc -&gt; RealReg -&gt; [instr] -&gt; RegM freeRegs [instr]
</span><a href="GHC.CmmToAsm.Reg.Linear.html#loadTemp"><span class="hs-identifier hs-var hs-var">loadTemp</span></a></span></span><span> </span><span id="local-6989586621681031993"><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681031993"><span class="hs-identifier hs-var">vreg</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.html#ReadMem"><span class="hs-identifier hs-type">ReadMem</span></a></span><span> </span><span id="local-6989586621681031992"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681031992"><span class="hs-identifier hs-var">slot</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681031991"><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681031991"><span class="hs-identifier hs-var">hreg</span></a></span></span><span> </span><span id="local-6989586621681031990"><span class="annot"><span class="annottext">[instr]
</span><a href="#local-6989586621681031990"><span class="hs-identifier hs-var">spills</span></a></span></span><span>
</span><span id="line-955"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-956"></span><span>        </span><span id="local-6989586621681031989"><span class="annot"><span class="annottext">instr
</span><a href="#local-6989586621681031989"><span class="hs-identifier hs-var">insn</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Reg -&gt; Int -&gt; RegM freeRegs instr
forall instr freeRegs.
Instruction instr =&gt;
Reg -&gt; Int -&gt; RegM freeRegs instr
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#loadR"><span class="hs-identifier hs-var">loadR</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RealReg -&gt; Reg
</span><a href="GHC.Platform.Reg.html#RegReal"><span class="hs-identifier hs-var">RegReal</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681031991"><span class="hs-identifier hs-var">hreg</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681031992"><span class="hs-identifier hs-var">slot</span></a></span><span>
</span><span id="line-957"></span><span>        </span><span class="annot"><span class="annottext">SpillReason -&gt; RegM freeRegs ()
forall freeRegs. SpillReason -&gt; RegM freeRegs ()
</span><a href="GHC.CmmToAsm.Reg.Linear.State.html#recordSpill"><span class="hs-identifier hs-var">recordSpill</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Unique -&gt; SpillReason
</span><a href="GHC.CmmToAsm.Reg.Linear.Base.html#SpillLoad"><span class="hs-identifier hs-var">SpillLoad</span></a></span><span> </span><span class="annot"><span class="annottext">(Unique -&gt; SpillReason) -&gt; Unique -&gt; SpillReason
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">VirtualReg -&gt; Unique
forall a. Uniquable a =&gt; a -&gt; Unique
</span><a href="GHC.Types.Unique.html#getUnique"><span class="hs-identifier hs-var">getUnique</span></a></span><span> </span><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681031993"><span class="hs-identifier hs-var">vreg</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-958"></span><span>        </span><span class="annot"><span class="annottext">[instr] -&gt; RegM freeRegs [instr]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span>  </span><span class="annot"><span class="annottext">([instr] -&gt; RegM freeRegs [instr])
-&gt; [instr] -&gt; RegM freeRegs [instr]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>  </span><span class="hs-comment">{- COMMENT (fsLit &quot;spill load&quot;) : -}</span><span> </span><span class="annot"><span class="annottext">instr
</span><a href="#local-6989586621681031989"><span class="hs-identifier hs-var">insn</span></a></span><span> </span><span class="annot"><span class="annottext">instr -&gt; [instr] -&gt; [instr]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[instr]
</span><a href="#local-6989586621681031990"><span class="hs-identifier hs-var">spills</span></a></span><span>
</span><span id="line-959"></span><span>
</span><span id="line-960"></span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.html#loadTemp"><span class="hs-identifier hs-var">loadTemp</span></a></span><span> </span><span class="annot"><span class="annottext">VirtualReg
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">SpillLoc
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">RealReg
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681031986"><span class="annot"><span class="annottext">[instr]
</span><a href="#local-6989586621681031986"><span class="hs-identifier hs-var">spills</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-961"></span><span>   </span><span class="annot"><span class="annottext">[instr] -&gt; RegM freeRegs [instr]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">[instr]
</span><a href="#local-6989586621681031986"><span class="hs-identifier hs-var">spills</span></a></span><span>
</span><span id="line-962"></span><span>
</span><span id="line-963"></span></pre></body></html>